The quantity that doesn’t changes in the program is called as the constant. It can be defined using #define preprocessor directive or by using const keyword.
There are four types of constant in C programming:
1. Integer Constants
An integer constant must have at least one digit.
It must not have a decimal point.
It can either be positive or negative.
No commas or blanks are allowed within an integer constant.
If no sign precedes an integer constant, it is assumed to be positive.
The allowable range for integer constants is -32768 to 32767.
2. Real Constants
A real constant must have at least one digit.
It must have a decimal point.
It could be either positive or negative.
If no sign precedes an integer constant, it is assumed to be positive.
No commas or blanks are allowed within a real constant.
3. Single Character Constants
Character constant is a character enclosed by single quote (‘ ’).
For example: ‘a’, ‘A’, ‘+’ etc.
4. String Constants
A special types of constants which stores fix sequence of character is known as string constants.