mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-13 18:24:39 +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:
|
||||
'\n' // newline character
|
||||
'\t' // tab character
|
||||
'\t' // tab character (left justifies text)
|
||||
'\v' // vertical tab
|
||||
'\f' // new page
|
||||
'\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)
|
||||
"%c" // char
|
||||
"%p" // pointer
|
||||
"%x" // hexidecimal
|
||||
"%o" // octal
|
||||
"%%" // prints %
|
||||
|
||||
// Constants: use #define keyword, no semicolon at end.
|
||||
#define DAYS_IN_YEAR = 365
|
||||
|
||||
// Import headers with #include
|
||||
#include <stdlib.h>
|
||||
|
Reference in New Issue
Block a user