Tag: 笛卡尔积

C中多个数组的笛卡尔积

我能够在C.中实现静态数组数的笛卡尔积。但是我想构建一个动态地获取输入数组的代码。有人可以解释如何“只使用数组”这样做。如果不可能的话有arrays请告诉我其他解决方案。谢谢。这是我的代码,下面是3个arrays的笛卡尔积。 #include int main(void) { int array1[100]; int array2[100]; int array3[100]; int cartesian_array[100][100]; int m,n,o; int i,j; int p=0,q=0,r=0; int x,y,z; int cartesian_arr_row_len; int cartesian_arr_col_len; printf(“Enter the size of first array:\n”); scanf(“%d”,&m); printf(“Enter the size of second array:\n”); scanf(“%d”,&n); printf(“Enter the size of third array:\n”); scanf(“%d”,&o); printf(“Enter the first array elements:\n”); for(i=0;i<m;i++) scanf("%d",&array1[i]); printf("Enter the […]