Welcome To Grey Shield

Website is under Maintenance

C program to find size of int, char, float, double

C program to find size of int , char , float , double 


#include<stdio.h>

int main()

{

    int intt;

    char charr;

    float floatt;

    double doublee;

    // use sizeof(varname) to find size of variable

    printf("size of int is %d bytes\n",sizeof(intt));

    printf("size of char is %d bytes\n",sizeof(charr));

    printf("size of float is %d bytes\n",sizeof(floatt));

    printf("size of double is %d bytes\n",sizeof(double));

    return 0;

}


Output:

size of int is 4 bytes

size of char is 1 bytes

size of float is 4 bytes

size of double is 8 bytes




Description:-

1. To find size of all variables we need to use a syntax sizeof(variablenamehere) through which you can easily calculate the size of all variables like int , float , char , etc.. 

If you have any doubt, Please let me know

Previous Post Next Post

Contact Form