cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
what is this??
what is this??
Jun 4, 2009 at 5:24pm UTC
oramiq
(50)
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 :)
Jun 4, 2009 at 5:28pm UTC
helios
(17607)
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
Jun 4, 2009 at 5:36pm UTC
oramiq
(50)
mmmmmmmmm,,,
but
1-why it is give me error using this "~" in compilation the code under linux??
2- why i use it??
Jun 4, 2009 at 5:40pm UTC
helios
(17607)
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?
Jun 6, 2009 at 4:09pm UTC
oramiq
(50)
i compile the code today with no errors !!!!!!!!!!!!!!
i didn't change anything !!??!!
thanks for helping
Topic archived. No new replies allowed.