Multiple choice

What is the difference between x (x without quotes) and 'x' (x with quotes)?

  1. The first x refers to a variable and the second one 'x' refers to the character constant.

  2. The first x is a character constant and second one 'x' is the string literal.

  3. Both are same

  4. The first x is a character constant and second one 'x' is a pointer.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

x (without quotes) refers to a variable named x, which is a named storage location in memory. 'x' (with single quotes) is a character constant representing the character 'x'. In C++, single quotes denote character constants while unquoted names are identifiers/variables. Option B is wrong because string literals use double quotes ("x"), and option D is incorrect because 'x' is a character constant, not a pointer.