There are three types of floating-point variables:
To declare a data object that is a floating-point type, use the following float specifier:
>>-+-float-------+--------------------------------------------->< +-double------+ '-long double-'
The declarator for a simple floating-point declaration is an identifier. Initialize a simple floating-point variable with a float constant or with a variable or expression that evaluates to an integer or floating-point number. The storage class of a variable determines how you initialize the variable.
Examples of Floating-Point Data Types
The following example defines the identifier pi as an object of type double:
double pi;
The following example defines the float variable real_number with the initial value 100.55:
static float real_number = 100.55f;
The following example defines the float variable float_var with the initial value 0.0143:
float float_var = 1.43e-2f;
The following example declares the long double variable maximum:
extern long double maximum;
The following example defines the array table with 20 elements of type double:
double table[20];
Related References