In this session we shall see rules for constructing integers constants. It may see to you what we are talking about...but you will soon understand everything. You just need to keep the points that we have covered in basics sessions.

# Rules for Constructing Integer Constants

- An integer constant must have at least one digit.
- It must NOT have a decimal point.
- It can be positive or negative.
- By default, integer is assumed to be positive.
- No commas or blanks should be used within the integer constant.
- Allowable range is -32768 to 32767

Range actually depends upon the compiler. Above mentioned range is for 16 bit compiler like Turbo C++ that we are going to use. For 32-bit compiler the range would be much greater. But we shall start with most basic compiler and then grow.

# Rules for Constructing Real Constants

- Real constants are also called
*floating point constants.* - Real constants are written in two ways -
*Fractional form and exponential form.*

*Following rules should be observed while constructing real constants:*

- A real constant must have atleast one digit.
- It must have a decimal point.
- It can be positive or negative.
- Default sign is positive.
- No commas and blanks are allowed within a real constant.

To understand the exponential form please see the video below:

# Rules for Constructing Character Constants

- It should be a single alphabet or symbol enclosed within single inverted comma. E.g 'A'
- Maximum length of character constant can be one character. So 'AB' is INVALID.

## No comments:

## Post a Comment