C examples for Language Basics:Variable
To add new lines into a string the escape character \n is used for representing a line break.
#include <stdio.h> int main(void) { printf("First line\nSecond line"); }
There are several other such characters as seen in the following table.
Character | Meaning | Character | Meaning |
---|---|---|---|
\n | newline | \f | form feed |
\t | horizontal tab | \a | alert sound |
\v | vertical tab | \' | single quote |
\b | backspace | \" | double quote |
\r | carriage return | \\ | backslash |
\0 | null character | \? | question mark |
\000 | octal number (1-3 digits) | \xhh | hexadecimal number |