C Program to print Size of all Data Types
Notes:
C Program to print Size of all Data Types:
#include <stdio.h>
int main()
{
printf("Size of char is %i byte\n",sizeof(char));// 1
printf("Size of signed char is %i byte\n",sizeof(signed char));// 1
printf("Size of unsigned char is %i byte\n\n",sizeof(unsigned char));// 1
printf("Size of int is %i byte\n",sizeof(int));// 4
printf("Size of signed int is %i byte\n",sizeof(signed int));// 4
printf("Size of unsigned int is %i byte\n\n",sizeof(unsigned int));// 4
printf("Size of short int is %i byte\n",sizeof(short int));//2
printf("Size of signed short int is %i byte\n",sizeof(signed short int));// 2
printf("Size of unsigned short int is %i byte\n\n",sizeof(unsigned short int));// 2
printf("Size of long int is %i byte\n",sizeof(long int)); // 4
printf("Size of signed long int is %i byte\n",sizeof(signed long int));// 4
printf("Size of unsigned long int is %i byte\n\n",sizeof(unsigned long int));//4
printf("Size of float is %i byte\n",sizeof(float));//4
printf("Size of double is %i byte\n",sizeof(double));//8
printf("Size of long double is %i byte\n\n",sizeof(long double));//12
printf("Size of \"hi\" is %i byte\n\n",sizeof("hi"));//3
printf("Size of 5 is %i byte\n\n",sizeof(5));//4
printf("Size of 5.5 is %i byte\n\n",sizeof(5.5));//8
printf("Size of 'A' is %i byte\n\n",sizeof((char)'A'));//1
return 0;
}