Let's extend this program to provide the ranges for each data type. While we could compute these values ourselves, they are defined in two header files—limits.h for integer limits and float.h for real number limits. To implement this, we add another function prototype, add a call to that function from within main(), and then define the function to print out the ranges. In the printRanges() function, we use the fixed-width types to avoid variations from system to system.
Let's add another function. In the following code, the additional include directives and function prototype are highlighted:
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <float.h>
// function prototypes
void printSizes( void );
void printRanges( void );
int main( void ) {
printSizes();
printRanges();
}
Now, having printRanges() prototypes, let's add its definition. The printSizes(...