请看下面的代码片段:
一些情况下,我无法理解二维数组的基地址和基地址上的值(也就是一个指向一维数组的地址)相同的概念。请解释一下。
#include <stdio.h>
#define ROW_SIZE 2
#define COL_SIZE 2
int main()
{
int a[ROW_SIZE][COL_SIZE]={{1,2},{3,4}};
// Base address:Pointer to the first element a 1D array
printf("Base address of array:%p\n",a);
//The value at the base address: should be the address of 1st 1D array
printf("Value at the Base address:%p\n",*a);
return 0;
}
获得的输出结果:
Sample Output:
Base address of array:0xbff77434
Value at the Base address:0xbff77434
一些情况下,我无法理解二维数组的基地址和基地址上的值(也就是一个指向一维数组的地址)相同的概念。请解释一下。