Syntax: sizeof( datatype )
See Also: C++ Program to Display The Size of Different Data Types
See Also: Java Program to Display The Size of Different Data Types
Below is the list of the Data Types in C or The size of data types in c. C Programming Data Type, Range and Size in Bytes.
C Program to Display The Size of Different Data Types
#include <stdio.h>
int main() {
printf("Size of Int Data Types in C = %2d bytes \n", sizeof(short int));
printf("Size of Long Int Data Types in C = %2d bytes \n", sizeof(long int));
printf("Size of Float Data Types in C = %2d bytes \n", sizeof(float));
printf("Size of Double Data Types in C = %2d bytes \n", sizeof(double));
printf("Size of Long Double Data Types in C = %2d bytes \n", sizeof(long double));
printf("Size of Char Data Types in C = %2d bytes \n", sizeof(char));
return 0;
}
See Also: Java Program to Display The Size of Different Data Types
The Output of Print Size of Data Types in C
List of Size of Data Types in C
- Int
- Long Int
- Float
- Char
- Double
- Long Double
Type | Range | Size (in bytes) |
Unsigned Char | 0 to 255 | 1 |
Signed Char or Char | -128 to +127 | 1 |
Unsigned Int | 0 to 65535 | 2 |
Signed Int or Int | -32,768 to +32767 | 2 |
Unsigned Short Int | 0 to 65535 | 2 |
Signed Short Int or Short Int | -32,768 to +32767 | 2 |
Unsigned Long Int | 0 to +4,294,967,295 | 4 |
Signed Long Int or Long Int | -2,147,483,648 to +2,147,483,647 | 4 |
Long Double | 3.4E-4932 to 1.1E+4932 | 10 |
Double | 1.7E-308 to 1.7E+308 | 8 |
Float | 3.4E-38 to 3.4E+38 | 4 |
0 Comments: