0

What does ~ mean in a logic operation?

Just going through some random questions, I got stuck in this. The program is as follows: int main() { bool a = true; bool b = false; bool c = ~(a&&b) cout<< c; return 0; } I wonder what is the function of ~ operator. Please help.

27th May 2017, 2:52 PM
Victor Das
Victor Das - avatar
1 Odpowiedź
+ 7
Tilde (~) is the bitwise complement operator. It takes the compliment of a binary value and adds a binary one to it. https://stackoverflow.com/questions/791328/how-does-the-bitwise-complement-operator-work
27th May 2017, 3:03 PM
Steven Schneider
Steven Schneider - avatar