C Program to Size of all C Language Data Types

In this program, you will learn how to display the data type sizes using sizeof() operator. Data types specify how we enter data into our programs and what type of data we enter. Sizeof is a compile time unary operator which can be used to compute the size of its operand.

Source Code
#include <stdio.h>
int main() {
  short s;
  int i;
  char c;
  float f;
  double d;
  long l;
  long double ld;

  printf("Size of short = %d bytes\n", sizeof(s));
  printf("Size of int = %d bytes\n", sizeof(i));
  printf("Size of char = %d byte\n", sizeof(c));
  printf("Size of float = %d bytes\n", sizeof(f));
  printf("Size of double = %d bytes\n", sizeof(d));
  printf("Size of long = %d bytes\n", sizeof(l));
  printf("Size of long double= %d bytes\n", sizeof(ld));
  return 0;
Size of short = 2 bytes
Size of int = 4 bytes
Size of char = 4 bytes
Size of float = 4 bytes
Size of double = 8 bytes
Size of long = 4 bytes
Size of long double= 12 bytes

"Coding Hub - Learn to code" app now available on Google Play Store