cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
-(BOOL) and +(BOOL)
-(BOOL) and +(BOOL)
May 29, 2015 at 9:20pm UTC
Emdamaker
(1)
what's the difference between these two?
May 29, 2015 at 10:18pm UTC
Peter87
(11238)
Before applying the unary + and - operators the bool value will be promoted to an integer value.
false -> 0
true -> 1
So that means
+false == 0
+true == 1
-false == 0
-true == -1
Last edited on
May 29, 2015 at 10:20pm UTC
Topic archived. No new replies allowed.