The bit shift by number greater than the type’s width should give a compilation error. as 1 is unsigned int and can be shifted by max 16.
Or is it dependent on compiler? I use gcc and this throws a compilation error.
Doubt on Bitmasking Quiz answer
It should be giving warning of overflow, but code should work(maybe a compiler issue)
1 is treated as int unless typecasted so 1<<32 will lead to overflow. So answer will be none of these.
If we change the statement to
long long x=(1LL<<32);
It will work perfectly.
If this resolves your doubt mark it as resolved.