char
data type in c
It is one
byte data type both in Turbo c compiler and Linux gcc compiler.
Memory
representation of char:
As we know
data type may signed or unsigned. In memory both unsigned char and signed are
stored in little different way.
Memory
representation of unsigned char:
As we know
char is integral data type. It can store integer or ASCII value of any
character. In memory its equivalent binary values is stored in 8 bit.
Examples:
1.
Memory representation of unsigned char a= 7;
Total size of unsigned char: 8 bit
Binary
equivalent of data 7 in eight bit: 00000111
Data
bit: 00000111
Here MSD stand for most significant digit and LSD for list significant digit.
2. Memory representation of signed char:
Total
size of signed char: 8 bit
Those
eight bits are use as:
Signe bit: 1
Data bit: 7
Data bit: 7
Note:
In c negative number is stored in 2’s complement format.
char
int
float
double
void
Data type tutorial home
C tutorial home.
No comments:
Post a Comment