mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-15 11:14:24 +02:00
Add more to string formatting.
This commit is contained in:
@@ -22,7 +22,7 @@ Multi-line comments look like this. They work in C89 as well.
|
|||||||
|
|
||||||
//Special characters:
|
//Special characters:
|
||||||
'\n' // newline character
|
'\n' // newline character
|
||||||
'\t' // tab character
|
'\t' // tab character (left justifies text)
|
||||||
'\v' // vertical tab
|
'\v' // vertical tab
|
||||||
'\f' // new page
|
'\f' // new page
|
||||||
'\r' // carriage return
|
'\r' // carriage return
|
||||||
@@ -38,6 +38,12 @@ Multi-line comments look like this. They work in C89 as well.
|
|||||||
"%7.4s" // (can do with strings too)
|
"%7.4s" // (can do with strings too)
|
||||||
"%c" // char
|
"%c" // char
|
||||||
"%p" // pointer
|
"%p" // pointer
|
||||||
|
"%x" // hexidecimal
|
||||||
|
"%o" // octal
|
||||||
|
"%%" // prints %
|
||||||
|
|
||||||
|
// Constants: use #define keyword, no semicolon at end.
|
||||||
|
#define DAYS_IN_YEAR = 365
|
||||||
|
|
||||||
// Import headers with #include
|
// Import headers with #include
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
Reference in New Issue
Block a user