Home / Programs / Storage size and range of floating point datatype
Programming Example

Storage size and range of floating point datatype

👁 1,188 Views
💻 Practical Program
📘 Step by Step Learning
In this program we will find out the size of float data type using sizeof operator. Also we will find out the range of floating point datatype.

Program Code

#include"stdio.h"
#include"float.h"

int main() {

   printf("Storage size for float : %d \n", sizeof(float));
   printf("Minimum float positive value: %E\n", FLT_MIN );
   printf("Maximum float positive value: %E\n", FLT_MAX );
   printf("Precision value: %d\n", FLT_DIG );
   
   return 0;
}

Output

Storage size for float : 4
Minimum float positive value: 1.175494E-038
Maximum float positive value: 3.402823E+038
Precision value: 6
Press any key to continue . . .

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.