What will be the output of the following C++ code snippet ?
#include <iostream>
using namespace std;
int main() {
char a = 66;
cout << a;
return 0;
}
Please first select an option.
The correct answer is D) B.
In the given C++ code snippet, the variable a is declared as a char and initialized with the integer value 66. In C++, character literals can be represented by their ASCII values.
The ASCII value of 'B' is 66. When you assign this integer value to a char variable, it is implicitly converted to its corresponding character.