我有一个二维数组
前任
int arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
那这个是什么类型的呢?
&arr[1]
我以为会是**
(双指针)
但是当我写一个函数时,比如
int **get_arr()
{
return &arr[1];
}
我收到警告
return from incompatible pointer type
最佳答案
Then what would be type of this?
&arr[1]
&arr[1]
的类型是int (*)[3]
,即它是 指向 3 个整数的数组的指针 类型。
I thought it would be
**
(double pointer)
你想错了。 &arr[1]
不是双指针。正如我已经提到的,它的类型是 int (*)[3]
.
关于C - 这个变量的类型是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21033136/