Constants in C refer to the fixed values that do not change during the execution of the program. We will look into different types of constants available in C.

Integer Constants
Decimal Integer
0 through 9, preceded by optional + and – sign. For Example, +123, -29
Hexadecimal Integer
A sequence of digits preceded by 0X or 0x, contains 0 through 9, A/a through F/f. For Example, 0xFF, 0XF1.
Octal Integer
0 through 7 preceded by 0. For Example, 0123, 099.
Real Constants
These numbers are shown in decimal notation, having a whole number followed by the decimal point and the fractional part. Example are 215.90, 0.566, .99, +9.99, .98.
Single Character Constants
A single character constant contains a single character enclosed with a pair of single quote marks. Examples are ‘5’, ‘A’, ‘;’.
Backslash Character Constant (escape sequence):
These represent a single character, although they consist of two characters. These combinations are also
known as escape sequences. They are used in output functions for example ‘\n’ stands for the newline character.
| Constant | Meaning |
|---|---|
| ‘\a’ | Audible alert(bell) |
| ‘\b’ | Back Space |
| ‘\f’ | Form Feed |
| ‘\n’ | New Line |
| ‘\r’ | Carriage Return |
| ‘\t’ | Horizontal Tab |
| ‘\v’ | Vertical Tab |
| ‘\” | Single Quote |
| ‘\”‘ | Double Quote |
| ‘\?’ | Question Mark |
| ‘\\’ | Back Slash |
| ‘\0’ | Null |
String Constants
The sequence of characters is enclosed in double quotes. Examples are “hello”, “hello Nepal 001”
Variables
A variable is a data name that may be used to store a data value. Unlike constants that remain unchanged
during the execution of the program, a variable may take different values at different times during execution.
Rules for naming variables( same as that of rules for naming identifiers)