DFUNDAMENTAL DATA TYPES

Integer data type

It is a data type which is used to hold data in whole number e.g. 40, 4, 97, 80 and its range is from -32768 to 32767. When we want to use integer data type, we have to specify “int” keyword. It takes two bytes in memory and the conversion specifier is %d.

Float type

This data type is used to store fractional numbers or these numbers are also called real numbers. In simple language we can say, this data type contains decimal value upto six decimal places. When we use decimal values to store then we can use it.

e.g. 49.797, 79718.80

it can hold either positive or negative value with or without decimal the conversion specifier used for float is %f. the range of float is -3.4*10-38 to 3.4*1038. it consumes 4 bytes in memory.

Character data type

This data type is used to store character enclosed in a pair of single quotes. E.g. ‘A’, ‘B’, ‘a’or even a blank space can be used as a character. This data type contains one byte on memory and the conversion specifier is %c.

STRING

We can also store number of characters in char data type within the range of -128 to 127. so when we store number of characters in char data type then it is converted into string data type. And we use conversion specifier %s.

Double data type

This data type is also used to store real type numbers and the keyword “double’ is used. It can hold values upto 16 decimal places and it consumes 8 bytes of memory. The conversion specifier is %lf. Its range is from 1.7*10-308 to 1.7*10308.

Long type

It contains whole number bigger than integer value is much bigger than integer. It consumes 4 bytes of memory and its range is from -2147483648 to 2147483647. Its conversion specifier is %l. e.g. 247894, 4774863.

Boolian

This data type is used in relational operators. It gives us result in true or false. If the output is false it returns to zero (0) and if output is true it returns to one (1). Its range is from 0 to 1 and it has not any conversion specifier.