Escape sequences in C: Difference between revisions
Appearance
Content deleted Content added
→Common escape sequences: (CMD) took out recent additions as they lack authoritative refereecnes |
|||
Line 13: | Line 13: | ||
* \' {{ndash}} Single quotation mark |
* \' {{ndash}} Single quotation mark |
||
* \" {{ndash}} Double quotation mark |
* \" {{ndash}} Double quotation mark |
||
* \0 {{ndash}} ASCII-0 character |
|||
* \ooo {{ndash}} [[Octal|Octal representation]] |
* \ooo {{ndash}} [[Octal|Octal representation]] |
||
* \xdd {{ndash}} [[Hexadecimal|Hexadecimal representation]] |
* \xdd {{ndash}} [[Hexadecimal|Hexadecimal representation]] |
Revision as of 19:23, 13 August 2013
It has been suggested that this article be merged with Escape sequence. (Discuss) Proposed since July 2011. |
Escape sequences are used in the programming languages C and C++. These are character combinations that comprise a backslash (\) followed by some character. They give results such as getting to the next line or a tab space. They are called escape sequences because the backslash causes an "escape" from the normal way characters are interpreted by the compiler.
Common escape sequences
- \a – Bell (beep)
- \b – Backspace
- \f – Formfeed
- \n – New line
- \r – Carriage return
- \t – Horizontal tab
- \\ – Backslash
- \' – Single quotation mark
- \" – Double quotation mark
- \0 – ASCII-0 character
- \ooo – Octal representation
- \xdd – Hexadecimal representation
Escape sequences are special strings used to control output from the C program on the monitor, or on any output device, e.g. the printer.
References
- C Programming Language by Brian W. Kernighan, Dennis M. Ritchie
- Object-Oriented Programming in Turbo C++ by Robert Lafore