||
/*add.c*/
int add(int a, int b)
{
return a+b;
}
/*head.h*/
#ifndef _HEAD_H
#define _HEAD_H
#include <stdio.h>
#include <math.h>
Int add(int a, int b);
#endif
/*main.c*/
#include “head.h”
int main(void)
{
int a=5;
int b=6;
int c=0;
c=add(a,b);
printf(“%d + %d = %d \n”, a, b, c);
c=pow(a,b);
printf(“%d^%d=%d \n”,a,b,c);
return 0;
}
编译以上源码,附带调试信息,然后运行程序。
Gcc –c –g add.c main.c
Gcc add.o main.o –o math –l m
./math
Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )
GMT+8, 2024-11-24 11:00 , Processed in 0.029440 second(s), 18 queries , Gzip On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.