C Program to Find Size of Data types

Write C Program to Print Size of Various Data types


int main()
    char charType;
    signed int signedIntType;
    int intType;
    long int longIntType;
    float floatType;
    double doubleType;
    long double longDoubleType;

    // sizeof evaluates the size of a variable
    printf("Size of char \t\t: %d byte\n", sizeof(charType));
    printf("Size of signed integer \t: %d byte\n", sizeof(signedIntType));
    printf("Size of int \t\t: %d bytes\n", sizeof(intType));
    printf("Size of long int \t: %d bytes\n", sizeof(longIntType));
    printf("Size of float \t\t: %d bytes\n", sizeof(floatType));
    printf("Size of double \t\t: %d bytes\n", sizeof(doubleType));
    printf("Size of long double \t: %d bytes\n", sizeof(longDoubleType));

    return 0;


Size of char : 1 byte
Size of signed int : 4 bytes
Size of int : 4 bytes
Size of long int : 4 bytes
Size of float : 4 bytes
Size of double : 8 bytes
Size of long double : 12 bytes

<< Previous | Next >>