In the series of learning programming, we learned about data types. Data type is a system for defining various properties of data stored in memory. Properties such as, type of data, range of data, bytes occupied etc.
Data type in C programming is categorized three categories.
- Primitive data type
- Derived data type
- User defined type
Read more – List of all format specifiers in C
Below is the list of all primitive and derived type in C programming.
List of primitive and derived data type in C
Data type | Size | Range | Description |
---|---|---|---|
char | 1 byte | -128 to 127 | A character |
signed char | |||
unsigned char | 1 byte | 0 to 255 | A character |
short | 2 bytes | −32,767 to 32,767 | Short signed integer of minimum 2 bytes |
signed short | |||
signed short int | |||
unsigned short | 2 bytes | 0 to 65,535 | Short unsigned integer of minimum 2 bytes |
unsigned short int | |||
int | 2 or 4 bytes | -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 | An integer (Both positive as well as negative) |
signed int | |||
unsigned int | 2 or 4 bytes | 0 to 65,535 or 0 to 4,294,967,295 | An unsigned integer (Positive integer) |
long | 4 bytes | -2,147,483,648 to 2,147,483,647 | Long signed integer of minimum 4 bytes |
signed long | |||
signed long int | |||
unsigned long | 4 bytes | 0 to 4,294,967,295 | Long unsigned integer of minimum 4 bytes |
unsigned long int | |||
long long | 8 bytes | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | Integer with doubled capacity as of long |
long long int | |||
signed long long | |||
signed long long int | |||
unsigned long long | 8 bytes | 0 to 18,446,744,073,709,551,615 | Unsigned integer with doubled capacity as of long |
unsigned long long int | |||
float | 4 bytes | 1.2E-38 to 3.4E+38 | Single precision floating point number |
double | 8 bytes | 2.3E-308 to 1.7E+308 | Double precision floating point number |
long double | 12 bytes | 3.4E-4932 to 1.1E+4932 | Double precision floating point number |
Important note: Size and range of data type is compiler dependent which may vary.
Read more –