1.

The difference between x and ‘x’ is?(a) The first one refers to a variable whose identifier is x and the second one refers to the character constant x(b) The first one is a character constant x and the second one is the string literal x(c) Both are same(d) Both are string literalI had been asked this question in exam.This key question is from Constants topic in portion Types, Pointers, Arrays & Structures in C++ of C++

Answer»

The correct answer is (a) The first one refers to a variable whose identifier is x and the SECOND one refers to the character CONSTANT x

For explanation: In a C++ code, names with quotes like ‘x’ REPRESENT a character or STRING(in CASE of a collection of characters) whereas without quotes they represent an identifier.



Discussion

No Comment Found

Related InterviewSolutions