Consider the two C++ statements that follow:
char grade = 65;
char grade = 'A';
Are they equivalent?
Ans:
The two statements are not really equivalent, although they have the same effect on some systems. Most importantly, the first statement assigns the letter A to grade only on a system using the ASCII code, while the second statement also works for other codes. Second, 65 is a type int constant, whereas 'A' is a type char constant.
0 Questions:
Post a Comment