Escape Sequences in C

Escape Sequences in C

·       Certain ASCII characters are unprintable , which means they are not displayed on the  screen or printer .
·       Those characters perform other functions aside from displaying text.
·       Examples are :
·       Backspacing , moving to a new line , or ringing a bell.


We have already  seen about  \n  in our previous post on topic "My first C program "


·       Escape sequence usually consist of a backslash and a letter or a combination of digits.
·       To represent the creation of  non printing characters such as newline character, single quotation mark , or certain other characters such as  “ , ‘ , ? and \ escape sequences can be used.
·       An escape sequence is regarded as  single character and is therefore valid as a character constant.
·       Escape sequences are typically used to specify actions such as carriage return and tab movement on terminals and printers.
·       The commonly used escape sequences are shown below.


Escape Sequences
Represents
ASCII value
\a
Bell(alert)
007
\b
Backspace
008
\f
Form feed
012
\n
New line
010
\r
Carriage return
013
\t
Horizontal tab
009
\v
Vertical tab
011
\’
Single quotation mark
039
\”
Double quotation mark
034
\?
Literal quotation mark
063
\\
Backslash
092
\0
Null
000


If a backslash precedes a character that does not appears in the above table , the compiler handles the undefined characters as the character itself and thus the result may be unpredictable.

Thank You ….

Previous Post
Next Post
Related Posts

0 comments:

Popular Posts