Saved Bookmarks
| 1. |
What is the size of a character literal in C and C++?(a) 4 and 1(b) 1 and 4(c) 1 and 1(d) 4 and 4The question was posed to me in final exam.This interesting question is from C++ Concepts in section Basics Concepts of C++ of C++ |
|
Answer» RIGHT choice is (a) 4 and 1 To explain I would say: The size of a character literal is 4 in case of C but it is ONE in case of C++. You can do printf(“%d”, (int)sizeof(‘a’)); in both C and C++ to check this. |
|