Data types :-
* Data types refers to which types of value to be stored into the variable.
* There are mainly two types of data types are available in c. language.
1. Primary Data types / Built-in Data types
2. User Defined Data types / Derived Data types
1. Integer Datatype :-
* We can use integer datatypes to store numeric values.
* C. language supports integer datatypes in both signed and unsigned.
* Integer datatpes has three types as short int, int and long int.
Types | Size (Bytes) | Range |
short int or signed short int | 1 | -128 to 127 |
int or signed int | 2 | -32768 to 32767 |
long int or signed long int | 4 | -2,147,483,648 to 2,147,483,647 |
unsigned short int | 1 | 0 to 255 |
unsigned int | 2 | 0 to 65535 |
unsigned long int | 4 | 0 to 4,294,967,295 |
2. Floating point Datatype :-
* Floating point datatypes can be used to store numeric values with decimal point.
* There are threen floating types available in c. language.
Types | 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 3.4e+4332 |
3. Charater Datatype :-
* Character datatype can be used to store a single character value.
Types | Size (Bytes) | Range |
char. or signed char. | 1 | -128 to 127 |
unsigned char. | 1 | 0 to 255 |
4. Void Datatype :-
* The void datatype has no values. The type of function does not returned any value at that time we can use void type.
Datatype | Format specifier |
int | %d |
character | %c |
float | %f |
double | %ld |
long double | %LD |
Post a Comment