C Program to find Size of Integer

C program to find the size of an integer, to find the size of any variable associated with any datatype, sizeof() operator will be used.

The following program shows the size of shortintlong and long long datatypes. 

#include <stdio.h>

int main(void) {
    printf("\n size of short: %d", sizeof(short));
    printf("\n size of int: %d", sizeof(int));
    printf("\n size of long int: %d", sizeof(long));
    printf("\n size of long long int: %d", sizeof(long long)); 
    return 0;
}

OUTPUT:

 size of short: 2
 size of int: 4
 size of long int: 4
 size of long long int: 8

Leave a Reply

Your email address will not be published.