I'm trying to send a 2d array as a double pointer to a function but it keeps me showing this error
matp.c:15:7: warning: passing argument 1 of ‘read’ from incompatible pointer type [-Wincompatible-pointer-types]
read(a,r,c);
matp.c:3:6: note: expected ‘int **’ but argument is of type ‘int (*)[(sizetype)(c)]’
void read(int **,int,int);
^~~~
here is the code
void read(int **,int,int);
void disp(int **,int,int);
int main()
{
int r,c;
int a[r][c];
printf("\nEnter the elements of the matrix:\n");
read(a,r,c);
printf("\nThe entered matrix is:\n");
disp(a,r,c);
printf("\nThe transpose of the given matrix is :\n");
disp(a,c,r);
return 0;
}
void disp(int **a,int r,int c)
{
int i,j;
for(i=0;i<=r;i++)
{
for(j=0;j<=c;j++)
{
printf("%d",*(j+*(&(a)+i)));
}
}
return;
}
I tried to read a matrix and print it's transpose