Q. What is the output of the following C++ code?

Code:
#include<iostream> 
using namespace std; 
  
int a = 55; 
void fun() 
{ 
    int a = 20; 
    { 
        int a = 10; 
        cout << ::a << endl;  
    } 
} 
  
int main() 
{ 
    fun(); 
    return 0; 
}
  • (A) 10
  • (B) 20
  • (C) 55
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (C) 55

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
215
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Dharmendra Sir
Publisher
πŸ“ˆ
91%
Success Rate