Tuesday 9 December 2014

C Program to print size of various data types

Program to print sizes of various data types
#include<stdio.h>
#include<stdlib.h>
main()
{
int a=5;
float c=1.5;
printf("size of integer type is %d\n",sizeof(int));
printf("size of float type is %d\n",sizeof(float));
printf("size of double type is %d\n",sizeof(double));
printf("size of char type is %d\n",sizeof(char));
printf("size of a is %d\n",sizeof(a));
printf("size of F is %d\n",sizeof(1.5));
}
OutPut:
size of integer type is 4
size of float type is 4
size of double type is 8
size of char type is 1
size of a is 4
size of F is 8