Constants In C language

Constants are the terms that cannot be change during program execution. Constants can be classified as :

Integer constants

Integer constants are the constants in which there is no any fractional part.

Rules for Constructing Integer Constants

• An integer constant must have at least one digit.
• It must not have a decimal point.
• It can be either positive or negative.
• If no signed precedes an integer constant, it assumed to be positive.
• No commas or blanks are allowed within a integer constant.
• The allowable range for integer constants is -32768 to 32767.

Floating-point constants

Fractional constants are the constants that have either fractional part or exponent form.

Rules for Constructing Real/Float Constants

• A real constant must have at least one digit.
• It must have a decimal point.
• It could be either positive or negative.
• Default sign is positive.
• No commas or blanks are allowed within a real constant.

Character constants

A character constant is a single alphabet, a single digit or a single special symbol enclosed with single inverted commas i.e. ‘a’, ‘1’, ‘\$’.

Rules for Constructing Character Constants

• A character constant can only have a single digit, alphabet, or a special symbol.
• It must enclosed within single inverted commas. Both the inverted commas should point to the left.
• The maximum length of a character constant can be 1 character.