what is this??

hello every body
i saw a code that contain strange charachter "~"
it is used with zero only

ex:
if(x==~0)

ex2
y=~0

any body know what is this mean ??

thanks in advance :)
It's bitwise NOT. It inverts all the bits in a value.
For example, assuming sizeof(unsigned)==4:
1
2
unsigned a=~0;
//a==0xFFFFFFFF 
mmmmmmmmm,,,
but
1-why it is give me error using this "~" in compilation the code under linux??
2- why i use it??
1. The operator is perfectly valid in both C and C++. If a compiler is giving you errors, either you screwed up, or there's something very wrong with the compiler.
2. What?
i compile the code today with no errors !!!!!!!!!!!!!!
i didn't change anything !!??!!

thanks for helping
Topic archived. No new replies allowed.