请教诸神~ const用在二维数组上为什么会出现这种情况?
#include <stdio.h>void display(const int r[2][2]);
int
main()
{
int i,j;
int r[2][2];
for (i = 0; i < 2; ++i)
for (j = 0; j < 2; ++j)
scanf("%d", &r[i][j]);
display(r);
printf("\n");
return(0);
}
void
display(const int r[2][2])
{
int i,j;
for(i = 0; i < 2; ++i)
for (j = 0; j < 2; ++j)
printf("%d ", r[i][j]);
}
运行~出现:
a.c: In function ‘main’:
a.c:15: warning: passing argument 1 of ‘display’ from incompatible pointer type
a.c:3: note: expected ‘const int (*)[2]’ but argument is of type ‘int (*)[2]’
为什么~这是 什么意思?