I have some doubts related to initializing 2D array. at many places, (websites like geeks for geeks) I saw this type of declaration used.
#include <iostream>
using namespace std;
const int MAX = 100;
// Fills transpose of mat[N][N] in tr[N][N]
void transpose(int mat[][MAX], int tr[][MAX], int N)
{
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
tr[i][j] = mat[j][i];
}
Aucun commentaire:
Enregistrer un commentaire