Constants are the fixed values that never change
during the execution of a program. Constant values used within a program are also
known as Literals. These constant values occupy memory but do not have any
reference like variables. Following are the various types of constants:
An integer constant is nothing but a value
consisting of digits or numbers. These values never change during the execution
of a program. Integer constants can be octal, decimal and hexadecimal.
Example, 111, 1234
A character constant contains only a single character enclosed within a single quote (''). We can also represent character constant by providing ASCII value of it.
Example, 'A', '9'
A string constant contains a sequence of characters enclosed within double quotes ("").
Example, "Hello", "Programming"
Like integer constants that always contains an integer value. 'C' also provides real constants that contain a decimal point or a fraction value. The real constants are also called as floating point constants. The real constant contains a decimal point and a fractional value.
Example, 202.15, 300.00