Given a compiler which allocates 4 Bytes of memory to an integer variable, then what is the range of numbers that can be stored in such variable? Explain your answer.
A bit can store either one or a zero in which a byte has 8bits.to calculate possible value you take
2n where n is the number of bits.A four byte has 32 bits hence n will be 32
Hence 232=(4294967296 values) starting from zero numbers are
0 to +4,294,967,295 for singed int and
-2,147,483,648 to +2,147,483,647 for unsigned int.The values are divided in between for negative and positive values
Comments
Leave a comment