hi, please please give me exact explanation for the tilt symbol in c....
here i have paste the code and i m getting the output of 1... how it comes 1..?please explain me soon...

#include<stdio.h>
main()
{
int m=1;
~~~m;
printf("%x\n",m);
}

Well, the real story is you never write ~~~m back to m to print it out so you're getting your old value.

As for ~ it inverts the bits of an integer (bitwise not), so assuming a 32 bit integer:
m = 00000000 00000000 00000000 00000001
~m = 11111111 11111111 11111111 11111110
~~m = 00000000 00000000 00000000 00000001
~~~m = 11111111 11111111 11111111 11111110

Which equals -2 due to the signed nature of the integer and 2s -complements (check that out on Wikipedia if you're curious).

i cant get u... can u explain it in an easy way... i mean the complements.

>can u explain it in an easy way... i mean the complements
Bits go flip floppy.

commented: Nice! +1

thanj you very much........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.