Data Types In C Programming
C Programming supports different types of data types. The different data types require different memory for storage. There four basic data types int, char, float and double.
The 'int' is used to store the integer value, 'char' is used to store any character, 'float' is used to store the floating value and double is used to storing the double value.
Different data types also have a different range. Ranges may vary from compiler to compiler. The below specifiers on 32-bit GCC compiler.
The size of the operator can be used to fin the size of variables. The following program can be used to find the size of variableThe 'int' is used to store the integer value, 'char' is used to store any character, 'float' is used to store the floating value and double is used to storing the double value.
Different data types also have a different range. Ranges may vary from compiler to compiler. The below specifiers on 32-bit GCC compiler.
| Basic Data Types | Data Typs withe type qualifiers | Size(bytes) | Range |
|---|---|---|---|
| char | signed char | 1 | -128 to +127 |
| unsigned char | 1 | 0 to 255 | |
| int | int or signed int | 2 | -32768 to 32767 |
| unsigned int | 2 | 0 to 65535 | |
| short int or signed short int | 1 | -128 to 127 | |
| unsigned short int | 1 | 0 to 255 | |
| long int or signed long int | 4 | -2147483648 to 2147483647 | |
| unsigned long int | 4 | 0 to 4294967295 | |
| float | float | 4 | 3.4E-38 to 3.4E+38 |
| double | double | 8 | 1.7E-308 to 1.7E+308 |
| long double | 10 | 3.4E-4932 to 3.4E+4932 |
#include <stdio.h>
main()
{
printf("sizeof(char)=%u\n",sizeof(char));
printf("sizeof(short)=%u\n",sizeof(short));
printf("sizeof(int)=%u\n",sizeof(int));
printf("sizeof(long)=%u\n",sizeof(long));
printf("sizeof(float)=%u\n",sizeof(float));
printf("sizeof(double)=%u\n",sizeof(double));
printf("sizeof(long double)=%u\n",sizeof(long double));
}
The output is
Please feel free to comment if you find anything incorrect or you want to share more information about the topic discussed above.

Comments
Post a Comment