Character: A character denotes an alphabet, digit or a special character.
Single Character constants: A single character constant or character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the inverted commas should point to the left.
For example, ۥAۥ is a valid character constant whereas ‛Aۥ is not. Note that the character constant ۥ 5ۥ is not the same as the number 5.
Valid Character Constants: ۥmۥ ۥ=ۥ ۥAۥ
ۥInvalid: ۥ123ۥ - Length should be 1
"A" - Enclosed in single quotes
Note: - Each single character constant has an integer value that is determined by the computer’s particular character set.
Rules for Constructing Single Character constants
1. A single character constant or character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the
inverted commas should point to the left.
2. The maximum length of a single character constant can be one character.
3. Each character constant has an integer value that is determined by the computer’s particular character set.
Questions
Single Character constants: A single character constant or character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the inverted commas should point to the left.
For example, ۥAۥ is a valid character constant whereas ‛Aۥ is not. Note that the character constant ۥ 5ۥ is not the same as the number 5.
Valid Character Constants: ۥmۥ ۥ=ۥ ۥAۥ
ۥInvalid: ۥ123ۥ - Length should be 1
"A" - Enclosed in single quotes
Note: - Each single character constant has an integer value that is determined by the computer’s particular character set.
Rules for Constructing Single Character constants
1. A single character constant or character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the
inverted commas should point to the left.
2. The maximum length of a single character constant can be one character.
3. Each character constant has an integer value that is determined by the computer’s particular character set.
Questions
- Define Character (Or) What is a character?
- What is a Single Character Constant? Give valid and Invalid constants?
- State the rules for constructing single character constants.