So i have to take the values from an array i made in a function and use that array in another function. How do i do that? Pretty much the values i need are those of 'div_array' 'rows' and 'cols'. I used "return div_array, rows, cols;" but i dont think thats how it works. How can i take their value after the calculations and use them in another function?
int DivisionArray(int ** div_array, int *array, int N, int rows, int cols) {
int counter = 1;
for (int i = 1; i <= N - 1; i++) {
for (int j = 1; j <= N - 1; j++) {
for (int k = 1; k <= N - 1; k++) {
if ((array[i] * array[j]) - (N*k) == 1) {
counter++;
}
}
}
}
cols = counter;
div_array[0][0] = 1;
div_array[1][0] = 1;
int temp = 1;
for (int i = 1; i <= N - 1; i++) {
for (int j = 1; j <= N - 1; j++) {
for (int k = 1; k <= N - 1; k++) {
if ((array[i] * array[j]) - (N*k) == 1) {
div_array[0][temp] = array[i];
div_array[1][temp] = array[j];
temp++;
}
}
}
}
for (int i = 0; i <= rows - 1; i++) {
for (int j = 0; j <= cols - 1; j++) {
cout << div_array[i][j] << "\t";
}
cout << endl;
}
return div_array, rows, cols;
}