C Program To Determine The Size Of An Int, Float, Double Or Char

This program determines the size of data types like char, int, float, and double.

Example: In C, write a program to determine the size of data types.

The sizeof() operator is used in this program to determine the size of data types. When the sizeof function is applied to primitive data types such as int, float, double, and char, it returns the amount of memory that has been allocated to them.

int main()
    printf("Size of char: %ld byte\n",sizeof(char));
    printf("Size of int: %ld bytes\n",sizeof(int));
    printf("Size of float: %ld bytes\n",sizeof(float));
    printf("Size of double: %ld bytes", sizeof(double));
    return 0;


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

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button