Code: #include<stdio.h> #define col 3 #define row 3 void foo(int *a,int col , int row) { int i,j; int *a[col][row]; for(i=0;i<col;i++) { for(j=0;j<row;i++) { printf(" %d\n",*a[i][j]); } } } main() { int arr[col][row] = {(1,2,3),(4,5,6),(6,7,8)}; foo(&arr[0][0],col,row); } I am getting this error parse error before numeric constant
> int arr[col][row] = {(1,2,3),(4,5,6),(6,7,8)}; All those ( ) should be { } > void foo(int *a,int col , int row) Is it your intention to "flatten" the array like this, or is it just something you figured out how to pass a 2D array into a function. void foo ( int a[row][col], int row, int col ) would accept a true 2D array. Also, your row and col are the same names as your #defines, so the line expands to void foo(int *a,int 3, int 3) Tip: All #defines should be written in upper case, like #define ROW 3