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 data types:
Size of int is: 4 Size of char is: 1 Size of float 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
- Lex Program to accept a valid integer and float value
- Python 3 | Program to print double sided stair-case pattern
- What's difference between char s and char *s in C?
- What is the difference between "char a" and "char a"?
- 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 ?
- Difference between const char *p, char * const p and const char * const p
- 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