#include<stdio.h>
int main()
{
int a[2][3] = {3,5,4,7,9,0};
int i, j;
for (i=0; i<2; i++)
{
for (j=0; j<3; j++)
printf(“%p\n”, *(a+i) +j); // Statment 1
}
}
正如您所看到的,为什么标记语句意味着它是二维array[a]
的地址点?这不意味着它是array[a]
的值吗?我不明白星号是否意味着它从(a + i)获得价值?
答案 0 :(得分:0)
这是我在Google上找到的一个例子
int a=9;
int *b = &a;
printf("%p\n",b);
在Win32系统上,将打印以下结果:
0018FF20
因为您可以看到说明符p
用于获取指针当前指向的地址。
As a result *(a+i)+j would give you the address where the pointer is pointing in a 2-D array
As a result *(a+0)+0 would give you the 1st row and 1st column address
*(a+0)+1 would give you the 1st row and 2nd column address
*(a+1)+0 would give you the 2nd row and 1st column address.