Given four types of variables, namely int, char, float and double, the task is to write a program in C to find the size of these four types of variables.
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 integerType, floatType, doubleType and charType. Then, the size of the variables is calculated using the sizeof() operator.
Below is the C program to find the size of int, char, float and double data types:
Size of int is: 4 Size of char is: 1 Size of float is: 4 Size of double is: 8
- size of char datatype and char array in C
- Difference between float and double in C/C++
- Modulus of two float or double numbers
- C Program to find size of a File
- What is the difference between single quoted and double quoted declaration of char array?
- C program to print a string without any quote (singe or double) in the program
- Lex Program to accept a valid integer and float value
- Python 3 | Program to print double sided stair-case pattern
- C Program for Maximum size square sub-matrix with all 1s
- C / C++ Program for Median of two sorted arrays of same size
- Program that receives a number and prints it out in large size
- How to find size of array in C/C++ without using sizeof ?
- What's difference between char s and char *s in C?
- What is the difference between "char a" and "char a"?
- C Program for Program to find area of a circle
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.
Improved By : rameshmarisa