I was trying to understand the bitwise operation and according to me integer contains 32 bit and from LSB 0th position to MSB 31st position so if I set left shift 1 to 31 place I think I should get 2^31 and the binary representation of it would be 10000000 00000000 00000000 00000000 so why in am getting the result as negative ? and please correct me if I am wrong.
#include<bits/stdc++.h>
using namespace std;
int main(){
int i=1<<31;
cout<<i;
return 0;
}