- DataTypes are used for declaring variables And functions of different types.
- When Program store data in variables, It is necessary that each variable must be assigned a specific data type.
Following are the list of Data Types in C :
| Keyword | Memory | Range |
|---|---|---|
| char or signed char | 1 Byte | -128 to 127 |
| unsigned char | 1 Byte | 0 to 255 |
| int or signed int | 2 Byte | -32,768 - 32,767 |
| unsigned int | 2 Byte | 0 to 65535 |
| short int or signed short int | 1 Byte | -128 to 127 |
| unsigned short int | 1 Byte | 0 to 255 |
| long or signed long | 4 Bytes | -2,147,483,648 to 2,147,483,647 |
| unsigned long | 4 Bytes | 0 to 4,294,967,295 |
| float | 4 Bytes | 3.4E - 38 to 3.4E + 38 |
| double | 8 Byte | 1.7E - 308 to 1.7E + 308 |
| long double | 10 Bytes | 3.4E-4932 to 1.1E + 4932 |
Declaration of variable :
main()
{
/* declaration */
//long int is datatype and amount is variable name
long int amount;
//int is datatype and code is variable name
int code;
char c;
double average;
float x,y;
}

No comments:
Post a Comment