We know some escape sequence ‘\n’ – new line but say we don’t know if \a, \b, \c …. \z is an escape sequence. How to write a program that allows us to test every character from a to z and/or A to Z in a printf statement or other way to identify an escape sequence and if it is, then print it’s value e.g. ouput may look like this:
‘\b’ is a special character and value of ‘\b’ = 8
This program may look silly but I am not able to find a solution for it…
Thanks in advance.
As Carl Norum pointed out, these are interpreted by the compiler. You can take an approach similar to autoconf (the program which generates
configurescripts):Output:
Notes: The reason for a string constant rather than a character constant is simply shell quoting. This relies on
gcc‘s-Werrorbut you could solve that problem in other ways.