Data type specifies the type of data, entered by the user. Data types are divided into two major categories:
1. Primary Data Type: Primary data types are also known as Primitive or Pre-defined data types. It is divided into 3 categories.
a. Integer (Non-Decimal): Only integer values are allowed.
b. Real (Decimal): In Real data type, decimal values can be used.
c. Character: Character data type can store only single character.
S.No. | Data Type | Size | Format | Range |
---|---|---|---|---|
int short signed signed int |
16 or 32 bits 16 bits 16 bits 16 or 32 bits |
%d | -32768 to 32767 | |
unsigned int unsigned short int |
16 or 32 bits 16 bits |
%u | 0 to 65535 | |
long long int |
32 bits | %ld | -2147483648 to 2147483647 | |
unsigned long | 32 bits | %lu | 0 to 4294967295 | |
long long int | 64 bits | %ld | -263 to 263-1 |
S.No. | Data Type | Size | Format | Range |
---|---|---|---|---|
float | 32 bits | %f | -3.4e38 to 3.4e38 | |
double | 64 bits | %lf | -1.7e308 to 1.7e308 | |
long double | 80 bits | %LF | -1.7e4932 to 1.7e4932 |
S.No. | Data Type | Size | Format | Range |
---|---|---|---|---|
char | 8 bits | %c | -127 to 127 | |
array of char (string) | Depends on declaration | %s | Depends on declaration |
2. Secondary / Non – Primitive / User Defined Data Types : These data types are defined and use by user according to his requirements. Secondary data types are: