Wednesday, April 16, 2014

c++ escape sequence characters

Escape sequences


Escape sequences are used to define certain special characters within string literals.
The following escape sequences are available:
Escape
sequence
DescriptionRepresentation
\'single quotebyte 0x27
\"double quotebyte 0x22
\?question markbyte 0x3f
\\backslashbyte 0x5c
\0null characterbyte 0x00
\aaudible bellbyte 0x07
\bbackspacebyte 0x08
\fform feed - new pagebyte 0x0c
\nline feed - new linebyte 0x0a
\rcarriage returnbyte 0x0d
\thorizontal tabbyte 0x09
\vvertical tabbyte 0x0b
\nnnarbitrary octal valuebyte nnn
\xnnarbitrary hexadecimal valuebyte nn
\unnnnarbitrary Unicode value.
May result in several characters.
code point U+nnnn
\Unnnnnnnnarbitrary Unicode value.
May result in several characters.
code point U+nnnnnnnn

Example

#include <iostream>
 
void main()
{
    cout<<"aaa"<<"\n"<<"bbb";
getch();
}
Output:
aaa
bbb



0 comments:

Post a Comment