real constants are also called real numbers or floating-point numbers. A real constant can be expressed in two forms in C language.
I. Decimal form
Decimal form is a real number representation form consisting of numbers and decimal points. For example, .123, .123, 123. and . are all legal real constants.
note: real constants expressed in decimal form must have decimal points.
Second, the exponential form
This form is similar to the exponential form in mathematics. In mathematics, one can be expressed as a power, for example, 2.326 can be expressed as .2326× 112.326× 123.26× 1-1. In C language, "e" or "e" is followed by an integer to represent the power number with "1" as the base. 2.326 can be expressed as .2326E1, 2.326e and 23.26e-1. According to the grammar of C language, there must be a number before the letter E or E, and the exponent after E or E must be an integer. Such as e3, 5e3.6,. E, E, etc. are all illegal exponential forms. Note: Do not insert spaces before and after the letter E or E or between numbers. In the process of running a program, the quantity whose value cannot be changed is called a constant. There are different types of constants, among which 12, and -5 are integer constants. A''b' is a character constant. While 4.6 and -8.7 are real constants.
a real constant can be assigned to a float, double or long double variable. According to the type of the variable, the corresponding significant digits in the real constant are intercepted.