Escape Character

Hi,

Should we write all escape characters in single quotes ?

\' = single quote
\v = vertical tab
\? = '?'
\ (octal number) and
\x (hexadecimal number) = corresponding ASCII character
\ (newline) = the string continues on the line below

\a = alarm or alert
\b = it is used for backspace.
\t = it is used for tab(long space)
\n = it is used for new line.
\f = it is used for form feed.
\r = it is used for return to the start of the same line.
\\ = it is used to print one back slash.
\" = it is used to print the inverted commas.
Only if you are writing a single character. If you are writing a string, use double quotes.

1
2
string s = "There's an apostrophe.";
char c = '\'';  // (an apostrophe) 

Hope this helps.
Topic archived. No new replies allowed.