什么是
a
,&a
和第一个元素a [0]
的地址之间的区别?同样,p
是分配给数组地址的整数指针。
pointer []
是否执行指针算术并根据数据类型获取值?进一步说,*
期望什么值?应该是一个指针吗?#include<stdio.h>
int main()
{
int a[] = {5,6,7,8};
int *p = a;
printf("\nThis is the address of a %u, value of &a %u, address of first element %u, value pointed by a %u", a, &a, &a[0], *a);
printf("\nThis is the address at p %u, value at p %u and the value pointed by p %d", &p, p, *p);
printf("\n");
}
This is the address of a 3219815716, value of &a 3219815716, address of first element 3219815716, value pointed by a 5
This is the address at p 3219815712, value at p 3219815716 and the value pointed by p 5