这个function错在哪儿了?(C语言)在线等。

来源:百度知道 编辑:UC知道 时间:2024/05/27 09:15:08
int calc_SPLTs(int valid,float x[],float y[],float w[],float SPLT[]) {
int xp,yp,k=0,j=0;
for (yp=0;yp<78;yp++) { /*start with y =0*/
for (xp=0;xp<78;xp++) {
int i=1;
double n=0.000,SPLT;
while (i<valid) {
n = calc_source(x[i],y[i],w[i],xp,yp)+n;
i++;
}
SPLT[j] =10*log10(n);
j++;
if (SPLT[j]>=80) {
k++;
}
}
}
return k;
}
x y w是已知数列,现在要定义一个新数列SPLTs[](除了他,其它都是已知的).
之前已经 float SPLTs[79*79] 了。
然后问题出现了
gcc -O0 -g3 -Wall -c -fmessage-length=0 -oProject-b1.o ..\Project-b1.c
..\Project-b1.c: In function `calc_SPLTs':
..\Project-b1.c:108: error: subscripted value is neither array nor pointer
..\Project-b1.c:110: error: subscripted value is neither array nor pointer
Build error occurred, build is stopped

请帮帮忙,谢谢。

double n=0.000,SPLT; //这个 SPLT 是错误的.

错误是说你的两个相加的变量既不是数组也不是指针,可能是找不到地址,传的应该是地址吧!

随便说说,你自己再调试看看!!