Sunday, 6 February 2011

Memory representation of signed int





Total
size of unsigned int: 16 bit

Those eight bits are use as:

Data bit: 15

Signe bit: 1











Note: In c negative number is
stored in 2’s complement format.



Example:

(1)Memory
representation of:



signed int a=7;            (In Turbo c
compiler)

signed short int a=7   (Both turbo c and
Linux gcc compiler)

Binary
equivalent of data 7 in 16 bit:  00000000 00000111

Data
bit:

No comments:

Post a Comment