There are two problems here:
- C does not support 2D arrays, only arrays of arrays or arrays of pointers to arrays, none of which are the same as a 2D array
- C , ( , 0- , , , , )
, - , 2D- - . , :
void set_T(float (*T1)[100]) {
... do stuff with T1[i][j] ...
}
int main() {
float T[100][100];
set_T(T);
}
T 100 100 , set_T 100 . 'T' set_T, 0- .
, - :
void set_T(float **T1) {
... do stuff with T1[i][j] ...
}
int main() {
float *T[100];
float space[100*100];
for (int i = 0; i < 100; i++)
T[i] = space + i*100;
set_T(T);
}
, , . , , set_T, .
, ++, C, C- - std::vector std::array - C 1D , (, , )