C++ local and global variables
// Local Variables Global Variables // j, p i, z #include <iostream> using namespace std; pr_again(); // Prototype int i = 0; // Global variable because it's defined outside main(). int main()//from w w w . jav a 2s .com { float p ; p = 9.0; cout << i << ", " << p << "\n"; pr_again(); return 0; } float z = 9.0; pr_again() { int j = 5; cout << j << ", " << z; cout << ", " << i << "\n"; return 0; }