mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Add print formatting characters
This commit is contained in:
parent
58cd4b274f
commit
deaaf3412d
@ -23,9 +23,22 @@ 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
|
||||||
|
'\v' // vertical tab
|
||||||
|
'\f' // new page
|
||||||
|
'\r' // carriage return
|
||||||
'\b' // backspace character
|
'\b' // backspace character
|
||||||
'\0' // null character
|
'\0' // null character
|
||||||
|
|
||||||
|
//print formatting:
|
||||||
|
"%d" // integer
|
||||||
|
"%3d" // minimum length of 3 digits for integer (right justifies text)
|
||||||
|
"%s" // string
|
||||||
|
"%f" // float
|
||||||
|
"%3.2f" // minimum 3 digits left and 2 digits right decimal float
|
||||||
|
"%7.4s" // (can do with strings too)
|
||||||
|
"%c" // char
|
||||||
|
"%p" // pointer
|
||||||
|
|
||||||
// Import headers with #include
|
// Import headers with #include
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user