Q.

What happens if a local variable exists with the same name as the global variable you want to access?

A. error
B. the local variable is shadowed
C. undefined behavior
D. the global variable is shadowed
Answer» D. the global variable is shadowed
Explanation: if a local variable exists with the same name as the local variable that you want to access, then the global variable is shadowed. that is, preference is given to the local variable.
2.3k
0
Do you find this helpful?
20

Discussion

No comments yet