I need to be able to pass a 2D array into the scanning function after scanning for the size of the array. Everywhere I've looked has told me that you can't pass 2D arrays without dimensions into a function, but I have no clue any other way to do it.
void scan_arrays (int *array, int row, int column);
int main (void){
int row;
int column;
printf("Enter sizes: ");
scanf("%d %d",&row,&column);
int firstarray[row][column];
int secondarray[row][column];
printf("Enter array 1 elements:\n");
scan_arrays(&firstarray,row,column);
printf("Enter array 2 elements:\n");
scan_arrays(&secondarray,row,column);
for(int i = 0; i < row; i++){
for(int j = 0; j < column; j++){
printf("%d ",firstarray[i][j]);
}
printf("\n");
}
for(int i = 0; i < row; i++){
for(int j = 0; j < column; j++){
printf("%d ",secondarray[i][j]);
}
printf("\n");
}
return 0;
}
void scan_arrays (int *array, int row, int column){
for(int i = 0; i < row; i++){
for(int j = 0; j < column; j++){
scanf("%d",&array[i][j]);
}
printf("\n");
}
}```
I've only been coding for a couple of months.