2D array passing in a function

How to pass a 2D array to a function if the rows and columns are input from the coder and are not constant? no of rows and columns can be any number

You can specify column to be equal to maximum possible column as per the constraints.
Like if in question it is mentioned that row<=1000 and col<=1000 then make an array of size 1001*1001 and pass current size as m and n in the function.
While using array in the function, treat row end as m and col end as n.

A better way is to use vector.Please read about it on the internet if you don’t know what vector is.