Why 2^32 cannot be stored in a long long variable in c++?

Viewed 66

I am using an assignment statement like: long long m = 2<<31;

Why this line gives warning " Signed shift result requires 34 bits to represent but, int only has 32 bits"? When I try to print m, output is 0.

When I use sizeof(long long) it says 8 bytes, i.e. 64 bits, much more than 32 bits. Then why it cannot accomodate?

Very much confused..please help.

0 Answers
Related