C Program to Find Size of Variable
#include<stdio.h>
int main()
{
int typeInteger;
float typeFloat;
double typeDouble;
char typeChareter;
// sizeof evaluates the size of a variable
printf("Size of int: %ld bytes\n",sizeof(typeInteger));
printf("Size of float: %ld bytes\n",sizeof(typeFloat));
printf("Size of double: %ld bytes\n",sizeof(typeDouble));
printf("Size of char: %ld bytes\n",sizeof(typeChareter));
return 0;
}
Output
Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Size of char: 1 bytes