Given four types of variables, namely int, char, float and double. The task is to write a program to find the size of these four types of variables in C.
Input: int Output: Size of int = 4 Input: double Output: Size of double = 8
In the below program, to find the size of the four variables, first the four types of variables are defined in , , and . Then, the size of the variables are calculated using sizeof() operator.
Below is the C program to find the size of int, char, float and double datatypes:
Size of int is: 4 Size of char is: 1 Size of floatType is: 4 Size of double is: 8
- Difference between float and double in C/C++
- Modulus of two float or double numbers
- What is the difference between single quoted and double quoted declaration of char array?
- C Program to find size of a File
- C program to print a string without any quote (singe or double) in the program
- Python 3 | Program to print double sided stair-case pattern
- What is the difference between "char a" and "char a"?
- What's difference between char s and char *s in C?
- Difference between const char *p, char * const p and const char * const p
- C / C++ Program for Median of two sorted arrays of same size
- C Program for Maximum size square sub-matrix with all 1s
- How to find size of array in C/C++ without using sizeof ?
- Program that receives a number and prints it out in large size
- Comparison of a float with a value in C
- Function Overloading and float in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.