Advertisements
Advertisements
Question
Consider the following C++ statement. Are they equivalent?
char ch = 67;
char ch = ‘C’;
Advertisements
Solution
Both the statements are equivalent as they declare ‘ch’ to be char and initialize it with the value of 67. Since this is the ASCII code for ‘C’, the character constant also can be used to initialize ‘ch’ to 67.
APPEARS IN
RELATED QUESTIONS
Which of the following statements is not true?
Can keywords be used as identifiers?
The following constant is of which type?
39
The following constant is of which type?
032
The following constant is of which type?
0XCAFE
Write the following real constant into the exponent form:
23.197
Write the following real constant into the exponent form:
0.00005
Describe the differences between keywords and identifiers?
Is C++ case sensitive? What is meant by the term “case sensitive”?
Write a short note on the const keyword with an example.
