c语言编写中,两个文件中,主函数如何调用子函数

写一个头文件命名为max.h
#ifndef MAX_H
#define MAX_H
void max(void);
#endif

然后主函数的文件包含max.h头文件
#include <stdio.h>
#include “max.h”
int main(void) {
max();
return 0;
}

子函数文件也要包含max.h
#include <stdio.h>
#include “max.h”
void max(void) {
printf(“世界,你好!\n”);
}

发布了10 篇原创文章 · 获赞 0 · 访问量 78

猜你喜欢

转载自blog.csdn.net/qq_43138346/article/details/103965382
今日推荐