extern 사용 질문,

sunuk의 이미지

파일 a.h

extern struct new arr[100];
extern int a;

---------------------

파일 a.c
include a.h

struct new arr[100];
int a;

...

arr[0]=another_arr[0];
a=100;

---------------------

파일 b.c
include a.h

---------------------

할 경우에 b.c에서 arr[100]이나 a를 쓸 수 없나요?

undefined가 나는데 b.c에서 a.c에서 사용한 값을 쓰려면 어떻게하나요? a.h에서 선언할경우 중복선언으로 오류가 생겨서
a.c에서 선언하고자합니다.

bushi의 이미지