[[lesson_13_globloca.cpp]] Rescued by C++ Reloaded

Route:


[user02@FC4 Lesson13]$ cat -n globloca.cpp
1 #include <iostream> 2 using namespace std; 3 4 int number = 1001; // Global variable

5 6 void show_numbers(int number) 7 { 8 cout << "Local variable number contains " << number << endl; 9 cout << "Global variable number contains " << ::number << endl; 10 } 11 12 int main() 13 { 14 int some_value = 2002; 15 16 show_numbers(some_value); 17 18 return 0; 19 }
[user02@FC4 Lesson13]$ g++ -o globloca globloca.cpp
[user02@FC4 Lesson13]$ ./globloca
Local variable number contains 2002
Global variable number contains 1001
[user02@FC4 Lesson13]$
lesson_13_globloca.cpp, Rev. 2, Last changed on 2005-08-18 07:11, 335 page hits
Wiki hosted for free at wikihost.org || RSS-Feed || GeboGebo 1.3.3 || 00.214 seconds || || PAGERANK TOOLS