C | Variable Declaration and Scope | Question 2
Predict the output
var = 20;
var = var;
(A) Garbage Value
(C) Compiler Error
Explanation: First var is declared, then value is assigned to it. As soon as var is declared as a local variable, it hides the global variable var.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.