what is space in c++??
example: \\ = "\"; \n ="return";......etc
thank you for helping.
what is space in c++??
example: \\ = "\"; \n ="return";......etc
thank you for helping.
uh.... ' ' is space or 0x20 for that matter. Maybe I misunderstand.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
According to this nifty site, there is no escape sequence for a space. Just use ' '. There's really no reason for space to have an escape sequence. Typing a space is no much easier.
FAQ
"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.
"If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.
In fact, you can use '\x20'.
V1P3R V3N0M
[email protected]
You could, but you wouldn't be writing portable code. 0x20 is not a space on all systems (see the EBCDIC chart for example where it's 0x40).
You can use isspace() to determine if a char is white space or not.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
yup, thx
but...
will I test all chars between 0x1A and 0x45 before printing a space or are all the systems 0x20 or 0x40?
anyway.. just use ' ' and the problem's gone
V1P3R V3N0M
[email protected]
>>will I test all chars between 0x1A and 0x45 before printing a space
I don't get what you mean?
>>are all the systems 0x20 or 0x40?
Again, it's NOT guaranteed. So stick with ' ' as you already pointed out. That way the compiler sorts it all out for you.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
I was saying that in the case the program was made to run on every OS'es, I'll have to test (with isspace()) every char code around 0x20 and 0x40 (so about 0x1A to 0x45) to be sure the character printed is really the space (in the case it changes a lot from an OS to another, to another and so on).will I test all chars between 0x1A and 0x45 before printing a space
but like I said.. we just use ' ' cuz there's no need to use the escape method to print a simple space!!!
sorry for the confusion here
V1P3R V3N0M
[email protected]
And to clarify even more, isspace() does white space testing, not ' ' space testing. So you need to decide which to use depending on your requirements.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]