## Constants

### Constants

Constant is an entity that never changes during the program execution.

Types of Constants

Constants are mainly divided into two category

- Scalar / Primitive Constants
- Composite Constants

The Scalar types of constant are those which can't be divided any more and the composite constant are those which can be divided into multiple scalar constants. In this lesson, we only discuss the Scalar/Primitive constant. The Composite constants are discussed later.

#### Integer Constant

- A number without any fractional part is called Integer constant.
- Example: 25, 0, -44, 456, etc...
- No decimal points are allowed.
**Example:**25 is correct but 25.0 is an incorrect integer constant.- Rules of Integer Constant +ve/-ve both types of values are allowed.
- Special symbols, Comma, and other characters are not allowed.
**Example:**2 3 4 and 12,500 are incorrect. **Valid Range:**-32768 to 32767

#### Floating-point constant or real constant

- It can contain decimal points.
- +ve/-ve both types of values are allowed.
- Special symbols, Comma and other characters are not allowed.
**Example:**5.3,200 or 5 .4 3 are incorrect. - Real constant can be specified in two ways
**Fractional Form:***Example:*437.86**Exponential Form:***Example:*4.3786E2 or 4.3786e2. - 4.3786E2 is equal to 4.3786 * 10
^{2}. **Valid Range:**3.4E-38 to 3.4e38- Exponential formats have two parts.
- The number before 'e' is called mantissa and after 'e' is called the exponent.

#### Character Constant

**Example:**'m', '@', '^', '9' etc.- It must be enclosed in single quotes.
- Character constant must be a single character.
- 'Jaipur' is an invalid character constant.

#### String Constant

A string is generally called a group of characters.

**Example:**"ABC","Jaipur","abc@example.com","ACX-124-EG-098"- String constant must be enclosed in double-quotes.