C++ local variables with the same name
#include <iostream> using namespace std; get_age(); // Prototype int main()/*from w w w.j a v a 2 s.c o m*/ { int age; cout << "What is your age? "; cin >> age; get_age(); // Call the second function. cout << "main()'s age is still " << age << "\n"; return 0; } get_age() { int age; cout << "What is your age again? "; cin >> age; return 0; }