본문 바로가기
C++

Understanding "extern" keyword in C

by 사향낭 2022. 1. 10.

 

 

Understanding "extern" keyword in C - GeeksforGeeks

A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

www.geeksforgeeks.org

 

여러 파일로 프로젝트를 진행할 때 다른 파일 안에 있는 전역변수를 쓰고 싶을 때, "extern" keyword로 linking 해주면 된다.

 

다만 definition 전에 변수를 사용하면 오류가 발생한다.

댓글