Floating point Constants in C Programming

Floating point Constants

A floating-point constant is a base-10 number that contains either a decimal point or an exponent or both. A floating-point constant can be written in two forms: Factorial form or Exponential form. A floating-point constant in a fractional form must have at least one digit each to the left and right of the decimal point. A floating-point in exponent form consists of a mantissa and an exponent. The mantissa itself is represented as a decimal integer constant or a decimal floating-point constant in fractional form. The letter E or e and the exponent follow the mantissa. The exponent must be a decimal integer. The actual number of digits in the mantissa and the exponent depends on the computer being used.

The following are valid floating-point constants.</1.0 0.1 2E-4 -0.1555e-4

The following floating-point constants are written incorrectly for the reasons stated.written incorrectly for the reasons stated.

1 No decimal point or exponent.
2,00.8 Illegal character (,).
2 E+10.20 Exponent must be an integer.
3 E10Illegal character (space).

Example:

Other basic types of constants in C are:

Ready to get started?

Ready to embark on your journey into the world of C programming? Our comprehensive course provides the perfect starting point for learners of all levels. With engaging lessons, hands-on exercises, and expert guidance, you'll gain the skills and confidence needed to excel in this fundamental programming language. Let's dive in and unlock the endless possibilities of C programming together!