I have seen many sites and referred books and reach to a point that tilde(~) operator is used to do ones' complement but when i ran the following code snippet ,i got amazed by its output.Can anybody explain me the output ??
The output coming is -11 for the following code. Any help will be appreciated.
#include <iostream>
using namespace std;
int main() {
int x=10;
cout<<~x;
return 0;
}