청강컴정/C++
extern - 링크
luckey
2009. 4. 30. 17:06
extern1.cpp | extern2.cpp |
#include <iostream> using namespace std; void Func(); -- extern2.cpp의 Func함수 void Test(int a); -- extern3.cpp의 Test함수 void main() Func(); Func(); |
#include <iostream> using namespace std; int a = 1; void Func() { cout << "외부파일에서 변수 출력 : a = " << a << endl; } |
extern3.cpp | |
#include <iostream>
using namespace std; void Test(int a) |
외부파일에 있는 내용을 참조하여 프로그램을 작성할 수 있다.