By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

what is the \r escape sequence

P: 1
if you give me some information about \r in c language
because now I am a teacher I want to give a good example to my students about this issue
Oct 17 '17 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 2,400
The method for putting printable characters in character and string constants is straightforward: 'A' or "Hello".
A different method is needed for nonprintable characters.

The most commonly used nonprintable characters can be expressed as a 2-character escape sequence. These escape sequences will work for any character encoding (ASCII, EBCDIC, etc).
'\a' alert (that is, BELL)
'\b' backspace
'\f' form feed
'\n' newline
'\r' carriage return
'\t' horizontal tab
'\v' vertical tab
'\\' backslash
'\'' single quote
'\"' double quote
'\?' question mark
Another way to specify characters is with a numeric escape code. However, the numeric values will depend on the character encoding.
\025 Octal value 25 (decimal 21)
\x15 Hexadecimal value 0x15 (decimal 21)
Oct 17 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.