access the elment inside 2D array

Hi,
I used dynamic array to create 2D matrix, which ask user to enter the size and elements of array.

My problem is how to access elements inside the matrix in order to get duplicates
elements.

someone mentioned that use variable pointer to the created matrix,
but i don't know the correct formation for that...

only learn c++ about 3 months... I am not good at programming..
int arr[5][2]; // 2D array. 5 rows, 2 columns.

If you want to acess the third row, second column. You would do
arr[2][1];

And if you for example wanted to access all of them, you'd need a nested for-loop. The outside one runs 5 times, the inside one runs twice.
Topic archived. No new replies allowed.