0
I wrote this code and result is -6. Can someone explain why?
#include<iostream> using namespace std; int main() { int x=5; cout<<~x; return 0; }
1 Resposta
+ 2
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators
http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/
~ inverts the bits
example
~ 1010 = 0101