为了账号安全,请及时绑定邮箱和手机立即绑定

请帮看下这个程序哪里错了 拜托了 实在看不出来

请帮看下这个程序哪里错了 拜托了 实在看不出来

C
Labermax 2017-11-10 20:37:21
我的是一个求积分的(用矩形面积)#include<stdio.h>#include<math.h>int main(){float integral(float(*)(float),float,float,int ); float fsin(float); float a1,b1,c,(*p)(float); int n=20; printf("input a1 and b1:"); scanf("%f%f",&a1,&b1); p=fsin; c=integral(p,a1,b1,n); printf("%lf\n",c); return 0;}float integral(float(*p)(float),float a,float b,int n){int i; double s,value,x=0,l; l=(b-a)/n; for(i=1;i<=n;i++)   x+=(*p)(a+i*l-l/2); s=x*(b-a); return(s);}float fsin(float x){return sin(x);}出现了错误:/tmp/ccOQLJgy.o:在函数‘fsin’中:e13.c:(.text+0x17f):对‘sin’未定义的引用collect2: error: ld returned 1 exit status能帮帮我吗 实在不明白了(明明引用了math.h 还说我sin没定义 好奇怪)谢谢
查看完整描述

2 回答

?
慕丝2543519

TA贡献5条经验 获得超0个赞

写个注释呗

查看完整回答
反对 回复 2017-11-10
  • 2 回答
  • 0 关注
  • 1477 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信