Constants
Explore the different types of constants in C programming including numeric, character, string, and enumeration constants. Understand their syntax, representation, and how they are used to store fixed values in variables. This lesson helps you grasp key data types essential for writing reliable C programs.
Constants are values that do not change after they have been defined. These values can be of different types.
Numeric constants
An example of an int constant is the number 1234. An example of a floating-point constant (by default typed as a double) is 123.4. Another example of a floating-point constant is 2e-3 (which represents 2 x in scientific notation). We can also write numbers in octal or hexadecimal representations instead of decimal: octal by using a leading zero (0) and ...