## Constants & Variables

### 1 Constants

** **

Constants in C are fixed value that does not change during the execution of a program. Constants can be of any of the basic data types. There are basic two types of Constants:

1) Primary Constants.

2) Secondary Constants

In Primary constants we have three types of constants:

a) Integer constants

b) Real constants

c) Character constants.

In Secondary constants we have various constants like Arrays, Pointer, structure, union and enum etc.

**Rules for constructing Integer constants**

1) An integer constant must have atleast one digit.

2) It must not have a decimal point.

3) It can be either positive or negative.

4) Default sign is positive.

5) The allowable range is -32768 to 32767

6) No commas or blanks are allowed.

For ex: 426, +782 ,-8000.

**Rules for constructing Real constants**

1) An real constant must have atleast one digit

2) It must have a decimal point.

3) It can be either positive or negative.

4) Default sign is positive.

5) No commas or blanks are allowed.

For ex: +325.34, -32.76, 426.0

**Rules for constructing Character constants**

1) A character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas.

Ex: ‘ A’, ‘1’, ‘=’.

2) Maximum length can be 1 character.