C++ local variables with the same name as counting variables
#include <iostream> using namespace std; do_fun(); // Prototype int main()/*from w ww. ja v a 2s . c om*/ { int ctr; // Loop counter. for (ctr=0; ctr<=10; ctr++) { cout << "main()'s ctr is " << ctr << "\n"; } do_fun(); // Call second function. return 0; } do_fun() { int ctr; for (ctr=10; ctr>=0; ctr--) { cout << "do_fun()'s ctr is " << ctr << "\n"; } return 0; // Return to main(). }