Friday, October 1, 2010

C program to print the memory sizes of all data types (with qualifiers)

int main()
{
int a;
char b;
float c;
double d;
long double e;
unsigned int f;

printf("Size of int data type is %d\n",sizeof(a));
printf("Size of char data type is %d\n",sizeof(b));
printf("Size of float data type is %d\n",sizeof(c));
printf("Size of double double data type is %d\n",sizeof(d));
printf("Size of long double int data type is %d\n",sizeof(e));
printf("Size of unsigned int data type is %d\n",sizeof(e));
system("pause");
return 0;
}

No comments:

Post a Comment

Google+ Followers