escape_sequences

C++ Reference

Constant Escape Sequences

The following escape sequences can be used to define certain special characters within strings:

Escape Sequence Description
\'Single quote
\”Double quote
\\Backslash
\nnnOctal number (nnn)
\0Null character (really just the octal number zero)
\aAudible bell
\bBackspace
\fFormfeed
\nNewline
\rCarriage return
\tHorizontal tab
\vVertical tab
\xnnnHexadecimal 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?"