twofile1.cpp 580 B

123456789101112131415161718
  1. // twofile1.cpp -- variables with external and internal linkage
  2. #include <iostream> // to be compiled with two file2.cpp
  3. int tom = 3; // external variable definition
  4. int dick = 30; // external variable definition
  5. static int harry = 300; // static, internal linkage
  6. // function prototype
  7. void remote_access();
  8. int main()
  9. {
  10. using namespace std;
  11. cout << "main() reports the following addresses:\n";
  12. cout << &tom << " = &tom, " << &dick << " = &dick, ";
  13. cout << &harry << " = &harry\n";
  14. remote_access();
  15. // cin.get();
  16. return 0;
  17. }