## What is Constant in C Language?

Constant in C refers to a value which cannot be changed i.e. a fixed value, like – 5, 5.6, “C Language”, 'C' etc.

## What are the types of C constant?

Primarily there are 3 types of C constant:

- Integer Constant
- Real Constant
- Character Constant

## What are the rules of constructing Integer constant?

The rules of constructing Integer constant are as follows:

- An integer constant must have at least one digit.

**Ex:** 3
- It must not have a decimal point.

**Ex:** 3.5 is wrong
- It can be either positive or negative.

**Ex:** +45 or -45
- If no sign precedes an integer constant it is assumed to be positive.

**Ex:** 67 is by default positive
- No commas or blanks are allowed within an integer constant.

**Ex:** 6,7 and 6 7 are wrong
- The allowable range for integer constants is -32768 to 32767 in case of a 16 bit compiler

**Ex:** 3563467 or -6575855 is out of range of integer in case of 16 bit compiler

## What are the rules of constructing real or floating point constant?

- A real constant must have at least one digit.

**Ex:** 3.0
- It must have a decimal point.

**Ex:** 45.65
- It could be either positive or negative.

**Ex:** +34.54 or -35.76
- Default sign is positive.

**Ex:** 453.76 s by default positive
- No commas or blanks are allowed within a real constant.

**Ex:** 6.,7 and 6. 7 are wrong
- The real constant can also be written as exponential form like 65.45e6, where the part before 'e' is known as mantissa and the part after e is called exponent.
- 7. The mantissa part must have decimal point whereas the exponent part must be an integer
- Both the mantissa part, and the exponent part may have a positive or negative sign, default is positive.
- Range of real constants expressed in exponential form is -3.4e38 to 3.4e38.

## What are the rules of constructing Character constant?

- Any single alphabet or single digit or single special symbol enclosed within the single inverted comma is treated as character constant.

**Ex:** 'b' or 'B' or '5' or '-' etc

but '45' or 'fs' or '=-' are wrong because they enclose more than a single character.