I have just been reading about escape characters and as well
as the obvious
'\n' newline
'\t' tab
kinda thing it also included
'\?'
What is the use of this escape character when '?' seems to work perfectly well?
Anyone?
Thanks.
Printable View
I have just been reading about escape characters and as well
as the obvious
'\n' newline
'\t' tab
kinda thing it also included
'\?'
What is the use of this escape character when '?' seems to work perfectly well?
Anyone?
Thanks.
Are you sure that ? is not to be replaced with something (from a list further down the page or something)?
When i run the above program both lines are identical.Code:#include<iostream>
using namespace std;
int main(void)
{
cout << "Hello?" << endl;
cout << "Hello\?" << endl;
return(0);
}
I use MSVC++ if that makes any difference!
The ASCII name for a question mark is simply the question mark character (?).
The C++ name for a question mark is preceded by the backslash character.
In this particular instance, there is little difference, but consider '\a' - alert - (C++). The ASCII name is 'BEL'.
Of course, there are others. In C++, '\n' is the newline character. In ASCII, it's NL or LF.
You just latched onto one that doesn't appear a lot different.
No doubt, the issue runs into "portability" and, I must confess, I'm ill-prepared to offer much to you in that area.
Perhaps others can.
:)