data types in c is used to spicefy the type of data. in a c programming each data has its own type and different from other data like 5, 10, 25, 9, 30(Integer numbers) is different from 3.23, 14.32, 93.21(Real numbers) and 'T', '5', 'c', '@', '+' (Single Characters) is different from "Technorials", "A001"(String).
To Store Different types of data in memory we first need to define their data type. Data types are used to define a variable. In C language a variable should be declared before it can be used in program. Data types are the keywords, which are used for assigning a type to a variable. there are the data types in c language.
To Store Different types of data in memory we first need to define their data type. Data types are used to define a variable. In C language a variable should be declared before it can be used in program. Data types are the keywords, which are used for assigning a type to a variable. there are the data types in c language.
Integer data types in c
An Integer data type in c can not have a decimal point. Comma or Blank space is not allowed in integer data types.
The Size and range depends on platform, to get size of a variable on a particular platform, you can use sizeof operator.
| Data Type | Storage Size | Range |
|---|---|---|
| char | 1 byte | -128 to +127 |
| unsigned char | 1 byte | 0 to 255 |
| signed char | 1 byte | -128 to 127 |
| int | 2 or 4 bytes | -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 |
| unsigned int | 2 or 4 bytes | 0 to 65,535 or 0 to 4,294,967,295 |
| short | 2 bytes | -32,768 to 32,767 |
| unsigned short | 2 bytes | 0 to 65,535 |
| long | 4 bytes | -2,147,483,648 to 2,147,483,647 |
| unsigned long | 4 bytes | 0 to 4,294,967,295 |
The Size and range depends on platform, to get size of a variable on a particular platform, you can use sizeof operator.
Floating Point data types in c
An floating point type in c have a decimal point and can be written in two forms - Fractional form and Exponential form. If the value of a real constant is either too small or too large then real constant can be expressed in exponential form.0.0000794 can be written in 7.94e-5. Part before 'e' is called mantissa and part after 'e' is called exponent.| Data Type | Storage Size | Range | Precision |
|---|---|---|---|
| float | 4 byte | 1.2E-38 to 3.4E+38 6 | decimal places |
| double | 8 byte | 2.3E-308 to 1.7E+308 | 15 decimal places |
| long double | 10 byte | 3.4E-4932 to 1.1E+4932 | 19 decimal places |
