dealing with 2d array inside a function

hello everybody , i have a problem with pointer array, i passed a 2d array to a function but then i dont know how to make operations on it !!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
using namespace std;

int fun_name (int * arr)
{
  for (int i = 0;i< ??? ;i++) // how to compare while i don't know the size of array!!
}
int main ()
{int **arr;
    
    arr = new int* [a];
    for(int z = 0;z<a;z++)
    {
        arr[z] = new int [b];
    }
    for(int x = 0; x<a; x++)
    {
        for (int y = 0; y<b; y++)
        {
          cout << "Enter value " << endl;
          cin >> arr[x][y];
        }
    }

   fun_name(arr);
Line 4: you only have one asterisk instead of two.

You should also pass to the function the dimensions of the array.
1
2
3
4
int func_name(int **arr, int rows, int cols)
{
    //...
}
thanks alot LB :)
Topic archived. No new replies allowed.