目录
使用gcc命令行方式编译运行主程序main1.c
1.编写程序
编写main1.c
#include"sub1.h"
int main()
{
int x=2,y=9;
printf("%.2f\n",x2x(x,y));
return 0;
}
编写sub1.c
#include"sub1.h"
float x2x(int a,int b)
{
float c;
c=(float)b/a;
return c;
}
编写sub1.h
#include<stdio.h>
float x2x(int a,int b);
分别储存在三个文档中
2.gcc编译的命令
3.编译运行
1.将sub1.c程序转换为目标文件sub1.o
2.编译main.c文件为目标文件main.o&#x