1.

Is the size of character literals different in C and C++?(a) Implementation defined(b) Can’t say(c) Yes, they are different(d) No, they are not differentThis question was posed to me in a job interview.This interesting question is from Character Types in chapter Types, Pointers, Arrays & Structures in C++ of C++

Answer»

Right choice is (C) YES, they are different

Easiest EXPLANATION - In C++, SIZEOF(‘a’) == sizeof(char) == 1. In C however, sizeof(‘a’) == sizeof(INT).



Discussion

No Comment Found

Related InterviewSolutions