大家帮忙看看,函数的形参传递问题

来源:百度知道 编辑:UC知道 时间:2024/05/08 23:58:52
出错行对应的程序 :
int B_arry[8];
int A_arry[8];
B_arry[8]={0,1,2,5,-2,-2,-2,-2};//cpp(262)
A_arry[8]={0,1,4,-2,-2,-2,-2,-2};//cpp(263)
int ding_p=0;
docu_length=create_b(B_arry[],A_arry[],ding_p);//cpp(265)
函数声明为:float create_b(int,int,int);
编译出错:
.cpp(262) : error C2059: syntax error : '{'
D:..cpp(262) : error C2143: syntax error : missing ';' before '{'
D:. cpp(262): error C2143: syntax error : missing ';' before '}'
D:. cpp(262): error C2059: syntax error : '{'
D:.cpp(263) : error C2143: syntax error : missing ';' before '{'
D:..cpp(263): error C2143: syntax error : missing ';' before '}'
D:..cpp(265): error C2059: syntax error : ']'
执行 cl.exe 时出错.

B_arry[8]={0,1,2,5,-2,-2,-2,-2};//这样赋值是不允许的,这样访问相当于是数组中的第8个数据

在定义的时候初始化是可以的
int B_arry[8]={0,1,2,5,-2,-2,-2,-2}
函数声明也不对:float create_b(int*,int*,int*);