C program to find the size of variables
In this example, discuss how to find the size of the variable in c programming language. Following is the code of the problem. Code: #include<stdio.h> int main() { int intvar; float floatvar; double doublevar; char charvar; // sizeof is used to find the size of a variable printf("Size of char: %zu byte\n", sizeof(charvar)); printf("Size of int: %zu bytes\n", sizeof(intvar)); printf("Size of double: %zu bytes\n", sizeof(doublevar)); printf("Size of float: %zu bytes\n", sizeof(floatvar)); return 0; } Output: Size of char: 1 byte Size of int: 4 bytes Size of double: 8 bytes Size of float: 4 bytes