Hello everyone, i want to ask how do we allocate memory for 2D array using pointers with 2 different inputs of rows and columns? Furthermore, i want to know how do we access different members of that particular array through pointers?

There are several ways to allocate arrays, here is just one of them.

int rows = 10;
int cols = 2;
int **arry = new int*[rows]
for(int i = 0; i < rows; i++)
   arry[i] = new int[cols];

If you need all the memory to be in one congiguous block of memory, then allocate like this and calculate the offsets to any given row and col.

int rows = 10;
int cols = 2;
int *arry = new int[rows*cols]