Data type are storage representations and machine instructions to handls constants differ from machine to machine.the variety of data type available allow the programmer to select the type approriate the needs of the application as well as the machine.
1.Primary Data type
2.Derived Data type
3.User-defined Datatype
In this topic we discussed in primary data type are available in c programming, all c compilers support five primary data type it is int,char,float,double,void the describe them are given in table.
Basic Data Types
Sr.No |
Operators |
Descriptions |
---|---|---|
01 |
char |
-128 to 127 |
02 |
int |
-32,768 to 32,767 |
03 |
float |
3.4e-38 to 3.4e+e38 |
04 |
double |
1.7e-308 to 1.7e+308 |
Integer Type
Integer are whole number with a range of values supported by a particular machine.generally integer occupy one word of storage.
Range and size of Integer Data Type
Sr.No |
Type |
Size |
Range |
---|---|---|---|
01 |
Char or signed char |
8 |
-128 to 127 |
02 |
Unsigned char |
8 |
0 to 255 |
03 |
Int or signed int |
16 |
-32.768 to 32,767 |
04 |
Unsigned int |
16 |
0 to 65535 |
05 |
Short int or signed short int |
8 |
-128 to 127 |
06 |
Unsigned short int |
8 |
0 to 255 |
07 |
Long int or signed long int |
32 |
-2,147,483,648 to 2,147,483,647 |
08 |
Unsigned long int |
32 |
0 to 4,294,967,295 |
09 |
float |
32 |
3.4E – 38 to 3.4E + 308 |
10 |
double |
64 |
1.7E – 308 to 1.7E + 308 |
11 |
Long double |
80 |
3.4E – 4932 to 1.1E + 4932 |
Floating Point Type
Floating point number are stored in 32 bit with 6 digits of precision. Floating defined in c by float keyword
For example float f1 = 10.01;
Void Type
The void type has no values.this is usually used to specify the type of functions.the type of a function is said to be void when it dose not return any value to the calling function.
Character Type
A single character can be defined as a character(char) type data.characters are usually stored in 8 bits(one byte) of internal storage.the qualifier signed or unsigned may be explicity applied to char while unsigned chars have values between 0 and 255,signed chars have values from -128 to 127.