"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
Data types are keywords. But every keywords are not data type. Data types are keywords which specify the nature of data or type of the data. Data type are also used to specify the size of data. Keywords mean some English alphabets which have predefine meaning in C.
Data Types | Storage size in byte |
---|---|
int | 2 byte |
float | 4 byte |
char | 1 byte |
double | 8 byte |
long | 4 byte |
Primary data are the data types which allow to store single value. It is also called primitive data type and primitive data types have first priority.
short, int, double, float, long, char, void;
In secondary data type we have further two types of data type. Which will allow to store multiple data or values.
Derived data type are already exist in C.
arrays, pointer, function;
User define data type are optional. It is defined by the users.
struct, enum, union;
Integers are used to store whole numbers.
Type | Size(bytes) | Range |
---|---|---|
int or signed int | 2 | -32,768 to 32767 |
unsigned int | 2 | 0 to 65535 |
short int or signed short int | 1 | -128 to 127 |
long int or signed long int | 4 | -2,147,483,648 to 2,147,483,647 |
unsigned long int | 4 | 0 to 4,294,967,295 |
Floating types are used to store real numbers.
Type | Size(bytes) | Range |
---|---|---|
Float | 4 | 3.4E-38 to 3.4E+38 |
double | 8 | 1.7E-308 to 1.7E+308 |
long double | 10 | 3.4E-4932 to 1.1E+4932 |
Character types are used to store characters value.
Type | Size(bytes) | Range |
---|---|---|
char or signed char | 1 | -128 to 127 |
unsigned char | 1 | 0 to 255 |
void type means no value. This is usually used to specify the type of functions.