Code:
#include<stdio.h>
main()
{
unsigned char a = -125;
unsigned int b = -125;
unsigned long c = -125;
unsigned short d =-125;
printf(" unsigned char a = %d sizeof a = %d \n", a,sizeof(a));
printf("Unsinged int b = %d sizeof b = %d \n",b,sizeof(b));
printf("Unsinged long c = %d sizeof c = %d \n",c,sizeof(c));
printf("Unsigned short d = %d sizeof d = %d \n",d,sizeof(d));
}
Output:
---------
$ ./a.out
unsigned char a = 131 sizeof a = 1
Unsinged int b = -125 sizeof b = 4
Unsinged long c = -125 sizeof c = 4
Unsigned short d = 65411 sizeof d = 2
$
How does the internal way representation differs from char to int,short,long?
Could anybody answer?
-Mahesh.