Sign in to follow this  
judge dreadz

explain this line of code?

Recommended Posts

You can also use '!' if you want to reverse a boolean's value.

For example,


bool bDummy = bool();

bDummy = !bDummy; //bDummy -> true
bDummy = !bDummy; //bDummy -> false


Share this post


Link to post
Share on other sites
Quote:
Original post by Spoonbender
That's not the same though. ^ is a bitwise operator. It only flips individual bits, not the entire boolean expression.


Yes, but I was just pointing out that if all he wanted to do was change a boolean's value, he could use '!'...

Share this post


Link to post
Share on other sites
As I've stated above, I was just POINTING OUT that if he wanted to change a boolean's value, he could use '!', that's all... I wasn't comparing '!' with '^'...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this