我该如何从函数返回一个数组?我的代码是
float ClassArray::arr_sub(float a[100][100], float b[100][100]) {
int i,j;
for(i = 1; i < 10; i++) {
for(j = 1; j < 10; j++){
f[i][j]=b[i][j]-a[i][j];
}
}
return f;
}
Run Code Online (Sandbox Code Playgroud)
并且应该将从此函数返回的f分配给在其他类中声明的另一个数组g.
float g[100][100];
g= cm.arr_sub(T,W);
Run Code Online (Sandbox Code Playgroud)
但是在建造课程时,它说incompatible type assignment of float to float[100][100].
c++ ×1