在我的下面示例代码中:
#include <stdio.h>
#include <stdlib.h>
int *find_degree(int *triangles, int m) {
int set[m * 3][2];
// do some stuff here and store some values in a two dimentional array called set
}
return set;//I think it is not the right way to do
}
int create_ploc(int *triangles, int m) {
int *set;
// trouble here , can not return the two dimentional array here from find_degree function
set= find_degree(triangles,m);
return 1;
}
int main() {
int point[6][3];
point[0][0] = 2;
point[0][1] = 4;
point[0][2] = 6;
point[1][0] = 4;
point[1][1] = 2;
point[1][2] = 3;
point[2][0] = 1;
point[2][1] = 3;
point[2][2] = 6;
point[3][0] = 2;
point[3][1] = 4;
point[3][2] = 1;
point[4][0] = 8;
point[4][1] = 6;
point[4][2] = 7;
point[5][0] = 2;
point[5][1] = 7;
point[5][2] = 3;
create_ploc(point, 6);
}
我试图从find_degree函数返回一个二维数组的地址,但似乎这不是正确的方法。有什么建议如何从find_degree函数返回2d数组的地址?