2d Array and pointers
Posted: Tue Jun 04, 2019 10:20 am
hello friends,
please find a simple test Code.
I defined 2D array and passing it to show function. I am not understanding why I am getting Warning..
Anyone kindly enlighten me...
warning: passing argument 1 of 'show' from incompatible pointer type
note: expected 'int *' but argument is of type 'int (*)[5][2]
please find a simple test Code.
I defined 2D array and passing it to show function. I am not understanding why I am getting Warning..
Anyone kindly enlighten me...
warning: passing argument 1 of 'show' from incompatible pointer type
note: expected 'int *' but argument is of type 'int (*)[5][2]
Code: Select all
int arr[ ][2]={{11,12},{21,22},{31,32},{41,42},{51,52}};
int i,m,n,*j;
m=5;
n=2;
show(arr,m,n);
void show (int *b,int l,int p)
{
int i,j;
printf("show \n");
for(i=0;i<l;i++){
printf("%d %d \n",*(b+i*2+0),*(b+i*2+1));
}
}