1 首先建头文件是为了声明c文件中的函数,以及包括宏定义。建立头文件要有对应的c文件。我简单地写了一个c文件,里面有一个函数。2 下面要写头文件首先要建一个.h文件 3 打开h文件,进行编辑。建立头文件是有一定步骤的。要用到#ifndef。。。#define。。。#endif。这是为了避免重复定义 4 #ifndef后面要写的...
1 #include<stdio.h> 2 #include "head.h" 3 void main() 4 { 5 int a=3,b=4,c=5,result=0; 6 result=add(a,b,c); 7 printf("The result is %d!",result); 8 } 1 2 3 4 5 6 7 8 4.将hello.c与head.c通过gcc命令编译起来 gcc -o cal hello.c head.c 1 5.执行可执行文件 ...