1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

#include <iostream>
using namespace std;
void read_Matrix(int Matrix[100][100], int &num_Lines, int &num_Columns);
void print_Matrix(int Matrix[100][100], int num_Lines, int num_Columns);
int main(int argc, char *argv[])
{
int Matrix[100][100];
int nLines = 0;
int nColumns = 0;
read_Matrix(Matrix,nLines,nColumns); // Variables lines, columns are sent by reference which means that before calling the function, their values are 0, 0 and after calling them, the function will return their new values in the main function.
print_Matrix(Matrix,nLines,nColumns); // Variables lines, columns are already initialized and are sent by value to the function, their values will remain unchanged.
return 0;
}
void read_Matrix(int Matrix[100][100], int &num_Lines, int &num_Columns)
{
cin >> num_Lines >> num_Columns;
for (int i = 0; i < num_Lines; i++)
{
for (int j = 0; j < num_Columns; j++)
{
cin >> Matrix[i][j];
}
}
}
void print_Matrix(int Matrix[100][100], int num_Lines, int num_Columns)
{
for (int i = 0; i < num_Lines; i++)
{
for (int j = 0; j < num_Columns; j++)
{
cout << Matrix[i][j] << " ";
}
cout << "\n";
}
}
