下面的脫逸序列可以在字串中表示一些特殊字元:
| 脫逸序列 | 敘述 |
|---|---|
| %% | 百分比符號 |
| \' | 單引號 |
| \” | 雙引號 |
| \\ | 反斜線 |
| \nnn | Octal number (nnn) |
| \0 | Null character (really just the octal number zero) |
| \a | Audible bell |
| \b | Backspace |
| \f | Formfeed |
| \n | 換行 |
| \r | Carriage return |
| \t | 水平定位(通常是往右位移到8的倍數) |
| \v | Vertical tab |
| \xnnn | Hexadecimal number (nnn) |
An example of this is contained in the following code (which assumes that the newline character generates complete newlines, i.e. on Unix systems):
printf( "This\nis\na\ntest\n\nShe said, \"How are you?\"\n" );
which would display
This
is
a
test
She said, "How are you?"