PracticeDev/study_cpp/cpp_primer_source_code/Chapter 9/twofile1.cpp

19 lines
598 B
C++
Raw Permalink Normal View History

2022-12-20 17:31:11 +08:00
// twofile1.cpp -- variables with external and internal linkage
#include <iostream> // to be compiled with two file2.cpp
int tom = 3; // external variable definition
int dick = 30; // external variable definition
static int harry = 300; // static, internal linkage
// function prototype
void remote_access();
int main()
{
using namespace std;
cout << "main() reports the following addresses:\n";
cout << &tom << " = &tom, " << &dick << " = &dick, ";
cout << &harry << " = &harry\n";
remote_access();
// cin.get();
return 0;
}