#include <iostream>
using namespace std;
void input(int row, int col, int *m) {
for (int i = 0; i < row; i++) {
cout << "Enter the element of row " << i + 1 << ": \n";
for (int j = 0; j < col; j++) {
cout << "Element " << j + 1 << ": ";
cin >> m[i][j];
cout << "\n";
}
}
for (int i = 0; i < row; i++) {
cout << "\n";
for (int j = 0; j < col; j++)
cout << m[i][j] << "\t";
}
}
int main() {
int row, col;
cout << "Enter row of the matrix: ";
cin >> row;
cout << "\nEnter col of the matrix: ";
cin >> col;
int matrix[row][col];
input(row, col, (int*)matrix);
}
When I compile this program, I kept receiving an error such as "
cannot convert 'int (*)[col]' to 'int*' for argument '3' to 'void input(int, int, int*)'
input(row, col, matrix);