View Single Post
Old Apr 26th, 2005, 3:37 PM   #1
357mag
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 148
Rep Power: 4 357mag is on a distinguished road
About using escape sequences

I found out that in order to use an escape sequence you must enclose it within either double quotes or single quotes like this:

cout << number << "\t" << endl;

or

cout << number << '\t' << endl;

If you do this the compiler will complain:

cout << number\t << endl;

I guess what I'm asking is the why of it(I'd like to know as much as possible cuz I always document my programs). Why for instance must you enclose the escape sequence in quotes? And why do both "\t" and '\t' work?
357mag is offline   Reply With Quote