Float Data Type


                                              Float  Data Type

The float data type is used to store fractional numbers (real numbers) with 6 digits of precision.
Floating point numbers are denoted by the keyword float. When the accuracy of the floating point
number is insufficient, we can use the double to define the number. The double is same as float
but with longer precision and takes double space (8 bytes) than float. To extend the precision
further we can use long double which occupies 10 bytes of memory space.


Syntax:
 
float <variable name>;
float num1;
double num2;
long double num3;


Example: 9.125, 3.1254.

Floating Point Data Type Memory Allocation:

float
double
long   double
1 byte
2 byte
4 byte
 
Initialization:-
Syntax:-
   
float<value name>=<value>;
float k=158.368;

Runtime:-
scanf("%f",&k);
 

Comments

Popular posts from this blog