Jul 21, 2014

K&R Exercise 1.2 list the escape sequence

Problem Statement

Exercise 1.2 Experiment to find out what happens when printf's argument string contains \c, where c is some character not listed above.


Solution

\c is called as escape sequence in C.

Here are commonly used escape sequence-




Escape 
Sequence
Character
\a
Bell
\b
Backspace
\f
Form feed
\n
New line
\r
Carriage Return
\t
Tab
\v
Vertical tab
\\
Backslash
\?
Question mark
\'
Single quote
\"
Double quote
\xnn
Hexadecimal character
 code nn
\onn
Octal character code nn
\nn
Octal character code nn

Next Article - K&R : Exercise 1.3 - Print heading to temperature conversion problem
Previous Article - K & R : Exercise 1.1 - Leave out parts of program
All Articles - K & R Answers 

No comments :

Post a Comment