Printing a 2-D arrat

Hello everyone!

I can't seem to write a function that prints a 2-D array

1
2
3
4
5
6
7
8
9
10
11
void print(int a[][], int row, int col)
{
    int i, j;
    for (i = 0; i < row; i++)
    {
        for (j = 0; j < col; j++) cout << a[i][j] << " ";
        cout << "\n";
    }
}

program doesn't compile... 
What is the error message you get? I don't see any errors on that code.
I think you have to supply all but one of your dimensions in a multi-dimension array argument:
 
void print(int a[][3], int row, int col)


Alternatively you can just pass the raw pointer:

 
void print(int** a, int row, int col)

Galik:

Could you please provide me with the code, I'm not too good using double pinters.
Topic archived. No new replies allowed.