Click here to Skip to main content
15,923,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello out there.

I have a small question that I seem unable to find a good answer at.

What is the differences between true/false and TRUE/FALSE (small vs cap. letters). In most cases it seems there are no real differences but I do get warnings in some cases.

Also... what is the difference between null and NULL?

All I can figure out is that this has something with the developmen from C to C++?

Feels like a stupid question... but I don't really have a clue. :cool:
Posted

1 solution

true and false are only valid values for type bool
bool mybool = true;

TRUE is #define TRUE 1 i.e. integer value 1
FALSE is #define FALSE 0 i.e. integer value 0
applied to BOOL

#define BOOL int
BOOL myBOOL = TRUE;
This is also possible
myBOOL = 6;
which is why bool was introduced


nullptr refers to a pointer with no address/value (null I think is c#)

NULL is #define NULL 0 but used as nullptr there for legacy reasons


TRUE, FALSE, NULL are #defines there for legacy reasons

true, false, nullptr are part of the language and recognised by the compiler
 
Share this answer
 
v3
Comments
Sandeep Mewara 17-Nov-10 4:17am    
Comment from OP:
Wow.. that was quick.

Then I got it. Thanks alot..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900