一、接上文建立头文件方式,本项目讲解引用自定义头文件方式,以及static和extern限制方法的作用。
接上文,建立项目,建立头文件print.h。
#include <stdio.h>
#include "printbefore.h"
void printHello(void);
建立实现文件,print.c,编辑内容如下:
#include "print.h"
void printHello()
{
printf("hello word!\n");
}
二、新建main.c主文件,编辑内容如下:
#include "print.h"
int main(void){
<span style="white-space:pre"> </span>printfBefore();
<span style="white-space:pre"> </span>printHello();
}
三、新建头文件printbefore.h,编辑内容如下:
#include <stdio.h>
void printfBe