What will be the output of the following C++ code?
#include<iostream>
using namespace std;
int x = 1;
int main()
{
int x = 2;
{
int x = 3;
cout << ::x << endl;
}
return 0;
}
#include<iostream>
using namespace std;
int x = 1;
int main()
{
int x = 2;
{
int x = 3;
cout << ::x << endl;
}
return 0;
}A. 1
B. 2
C. 3
D. 123
Answer: Option A
Related Questions on Introduction to C plus plus
What does the 'cin' object in C++ represent?
A. File output stream
B. File input stream
C. Standard output stream
D. Standard input stream

Join The Discussion