Is space a character ?
Is space a character ?
No. Also, in addition to whitespace, tabs, linefeeds, newlines, etc. are generally considered 'space'.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Yes, a space literal (' ') is a character, or perhaps more precisely, a char literal.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Are the answers different?
No, Laserlight is correct. It's early, and for some reason I was thinking 'alphanumeric character'.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 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