Please guide me on how I can pass a 2D- Array or any higher D Array to a function?
In the code, if I give columns i-e n the code will work.
Also is there any way how can I initialize the pointer with a 2D Array
void print(int arr[][], int m, int n)
{
std::cout << "{" << std::endl;;
for (int i = 0; i < m; i++,j++)
{
for (int j = 0; j < n; j++)
{
std::cout << arr[i][j]<<" " ;
}
std::cout << std::endl;
}
std::cout << "}" << std::endl;
}
int main()
{
int arr[2][3]{};
print(arr, 2, 3);
return 0;
}