Jump to content

Recommended Posts

Posted

first off the !!9 = 1 . ! (not operator) returns 0 if the value is non-zero, so !9 = 0 !!9 = !0 = 1, or the same as saying if not 9 = 0 in the possible answers of 0 and 1, then not not 9 must equal 1. !!!9 would then = 0 and !!!!9 = 1, and so on.

the ~ (tilde) operator is a bit-wise one's complement, which is very easy just invert all the bits

!0001100 = 1110011

so lets assume you have a one byte value, which when you said (char), makes it. it equals one (0000 0001) now if you perform a one's complement on that number you should get

1111 1110 which would be either 254 or -2 :confused: , negative numbers in binary or such a pain :(

you have to know when your dealing with them in assembly, c++ and other high languages take care of this for you, thats why you have to specify signed/unsigned if you need the extra space cause in signed variables the last bit is needed as the sign bit, 1 = negative, 0 = positive.

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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.