Wednesday, November 30, 2011

Escape sequences

The Character Combination consisting of a backslash '\' followed by a character is called an escape sequence. The escape sequences are used to specify some actions such as carriage return and tab space in terminals or printers. They are also used to represent some non-printable characters suxh as double quotes ( " ) which may have other special meanings in C.

The following escape sequences are supported by C language :

Escape SequenceUsage
\aBell (Alert)
\bBackspace
\fForm Feed
\nNew Line
\rCarriage Return
\tHorizontal Tab
\vVertical Tab
\'Single quote
\"Double quote
\\Back Slash
\?Question Mark
\0Null

Some of the escape sequences are devices specific. For example, \f and \v have no effect on the screen. But they are used for performing relevant printer operations.

No comments:

Post a Comment