extern 在C语言中,修饰符extern用在变量或者函数的声明前,用来说明“此变量/函数是在别处定义的,要在此处引用”。 extern可以用来修饰变量,也可以用来修饰函数。 例子:在一个工程里面有两个文件a.c and b.c,其中它们的内容如下: a.c: #include <stdio.h> int i = 3; int p(void) { printf("%d\n",i); return 0; } b.c: #include <stdlib.h> extern int