Constants
A constant is an entity that doesn't change during the execution of a
program.Followings are the different types of constants :
1. Real Constant :
- It must have at least one digit.
- It must have a decimal point which may be positive or negative.
- Use of blank space and comma is not allowed between real constants.
- Example:
+194.143, -416.41
2. Integer Constant :
- It must have at least one digit.
- It should not contain a decimal place.
- It can be positive or negative.
- Use of blank space and comma is not allowed between real constants.
- Example:
1990, 194, -394
3. Character Constant :
- It is a single alphabet or a digit or a special symbol enclosed in a single quote.
- Maximum length of a character constant is 1.
- Example:
'T', '9', '$'
4. String Constant :
- It is collection of characters enclosed in double quotes.
- It may contain letters, digits, special characters and blank space.
- Example:
"Technowell Web Solutions, Sangli"
No comments:
Post a Comment