InterviewSolution
Saved Bookmarks
| 1. |
In C++, Given Two Variables Of The Same Name, One Local And One Global, How Do I Access The Global Instance Within The Local Scope? |
|
Answer» Use the scope (::) operator. for(int x=0; x < ::x; x++) { COUT << "LOOP # " << x << "n"; // This will loop 10 times } Use the scope (::) operator. int x = 10; for(int x=0; x < ::x; x++) { cout << "Loop # " << x << "n"; // This will loop 10 times } |
|