An unsigned int can be twice as large as the signed int.  Explain how.

Q20. An unsigned int can be twice as large as the signed int.  Explain how.

Ans. An unsigned int (size 2 bytes) can represent 0 to 65,535, that is, 65,536 values in total whereas a signed int can represent -32768 to 32767, that is, 65,536 values in total. The total numbers represented by both (signed and unsigned) integers are the same, however, the highest number represented by unsigned int becomes double because in place of negative values, new positive values are represented thereby increasing the range by 32768 numbers as there are these many negative values represented by signed int. thus, when signed int can represented max 32767, then unsigned int can represent max 65535 which is twice as large as the signed int.

Leave a Reply

Your email address will not be published. Required fields are marked *

721 Views
%d bloggers like this: