GCC 컴파일러에서 컴파일 된 프로그램에 놀랐습니다. 성공적으로 작동했습니다. 컴파일러는 경고 만줍니다.C에서 extern 키워드의 동작
warning: 'i' initialized and declared 'extern' [enabled by default] extern int i = 10;^
내 코드 :
#include <stdio.h>
//Compiler version gcc 4.9
extern int i = 10;
int main()
{
printf("%d\n",i);
return 0;
}
출력 :
10
왜 포기하지 않는 컴파일러 오류? 정의되지 않은 동작입니까?
중복 가능성 http://stackoverflow.com/questions/496448/how-to-correctly-use-the-extern-keyword-in-c – 0xAX