This C program shows that how you can print size of any data type available in C language. To find size of any data type, C has one special operator sizeof. It simply calculates and returns the size of any given data type in bytes.
Program
#include <stdio.h> int main() { printf("Type Size (bytes)\n"); printf("Characte %d\n", sizeof(char)); printf("Integer %d\n", sizeof(int)); printf("Long int %d\n", sizeof(long int)); printf("Float %d\n", sizeof(float)); printf("Double %d\n", sizeof(double)); printf("Long double %d", sizeof(long double)); return 0; }
Output
Type Size (bytes)
Character 1
Integer 4
Long int 8
Float 4
Double 8
Long double 16