C Program to Find the Size of int, float, double and char
#include <stdio.h>
int main()
{
printf(“Size of int = %zu bytes\n”, sizeof(int));
printf(“Size of float = %zu bytes\n”, sizeof(float));
printf(“Size of double = %zu bytes\n”, sizeof(double));
printf(“Size of char = %zu byte\n”, sizeof(char));
return 0;
}
Explanation
sizeof(int)→ Finds the memory size occupied by anint.sizeof(float)→ Finds the memory size occupied by afloat.sizeof(double)→ Finds the memory size occupied by adouble.sizeof(char)→ Finds the memory size occupied by achar.sizeof()is an operator in C used to determine the size of a data type or variable in bytes.