Passing in function of 2d array

tell me if we passing array in a function using pointer.
what we will do?
or if we passing array in function using given input what i do for this.

In C++, when we pass an array to a function , it is always treated as a pointer by fun().
either you write like

void fun(int arr[],int n)

or you write like

void fun (int *arr,int n)

both are same internally

this is how to pass array in function

you have to take input in main and then pass to function

if you have more doubts fell free to ask
if doubt is resolved mark it as resolved

what in 2d array same doubt

Same concept is for 2D array
as 2D array is arrays of array

syntax of passing 2D array is

void fun(int arr[][size],int n,int m)

void fun(int **arr, int n ,int m)
second one is used only when there is dynamic allocation of 2D array

which is (dynamic allocation of 2D array)

int **arr=new int*[n];
for(int i=0;i<n;i++){
     arr[i]=new int [m];
}

you can skip it if
it is not taught to you now

but what is a[][size] “size” here bcz we give size m,n but what is size here . I don’t understand that thing.

hi @ankit_verma
here size is the size of 2D array

if arr[100][1000];

size is 1000