I want to display a 2D array, but my output is:
22 34 5 648 798 2477 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
What is wrong with my code since only the last column is displayed ?
Code:
int num_array[6][5] =
{
( 82,3,36,8,22 ) ,
( 6,2,88,9,34 ) ,
( 65,26,42,1,5 ) ,
( 46,1521,51,7,648 ) ,
( 14,39,5,792,798 ) ,
( 47,11,348,547,2477 )
};
int nNumRows = 6;
int nNumCols = 5;
for (int nRow = 0; nRow < nNumRows; nRow++)
for (int nCol = 0; nCol < nNumCols; nCol++)
cout << num_array[nRow][nCol] << " ";