Is space a character ?
This is a discussion on Is space a character ? within the C++ Programming forums, part of the General Programming Boards category; Is space a character ?...
Is space a character ?
No. Also, in addition to whitespace, tabs, linefeeds, newlines, etc. are generally considered 'space'.
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
Yes, a space literal (' ') is a character, or perhaps more precisely, a char literal.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Are the answers different?
No, Laserlight is correct. It's early, and for some reason I was thinking 'alphanumeric character'.![]()
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
Yes, they are two different answers. Yes, space is a character. But depending on the circumstances, it may be "ignored" by functions and applications. Other times it is very much "used" or "meaningful".
As a part of the ascii character set, space is definitely a character, with the value 0x20 (32 decimal). Other character sets may use other values.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
So, space is a character
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Nice. Thanks
For that matter, Unicode defines about 10 different space characters - space, n-width space, m-width space, zero-width non-joiner, non-breaking space, and more.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law