+ 1

What does (~)mean?

25th Jun 2018, 9:45 PM
Meso Gad
Meso Gad - avatar
3 Antworten
+ 1
In case of c/c++(I'm not aware of other langs) it works differently. Like ~n is ~(n+1). But in general, ~n will be converting it into equivalent 0's and 1's(binary) and toggling them and then again converting it back to decimal. Can someone plz explain this behaviour.
26th Jun 2018, 3:04 AM
Dilip Srinivas
Dilip Srinivas - avatar
+ 7
Bitwise not. If the starting bit is 1, make it 0, otherwise, make it 1. x = 0101 ~x = 1010
25th Jun 2018, 10:03 PM
John Wells
John Wells - avatar
25th Jun 2018, 10:36 PM
᠌᠌Code X
᠌᠌Code X - avatar