/*b.c*/
#include<stdio.h>
int p=3;
int func(int i)
{return p*i;}
int setp(int i)
/*a.c*/
#include<stdio.h>
extern int p;
extern int func(int i);
extern int setp(int i);//告訴系統這些函數在其他的文件當中
int main(int argc,char *argv[])
{
setp(4);
printf("%d",func(4));
}
/*Makefile*/
all: a
gcc -o a.o b.o
Then run make, run the programme, you will get result 16