通常将c函数的声明放在头文件,实现放在另一个文件,最后函数被其他文件调用。
一、声明
1 //last.h 2 3 #include <stdio.h> 4 5 void test1();
二、实现
1 //last.c
2
3 #include "last.h"
4
5 void test1(){
6 printf("hello world");
7 }
三、调用
//name.c
#include "last.h"
int main(){
test1();
}
四、编译运行
#gcc last.c -c
#gcc last.o name.c -o end
#./end
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/281790.html