数组名同时也是该数组首元素的地址。
#define SIZE 4
short dates [SIZE];
dates[0] = 1;
dates[1] = 2;
dates[2] = 3;
dates[3] = 4;
short *pti;
double bills[SIZE];
bills[0] = 1.1;
bills[1] = 2.2;
bills[2] = 3.3;
bills[3] = 4.4;
double *ptf;
short index;
pti = dates;
ptf = bills;
printf("%23s %10s\n","short","double");
for (index = 0; index<SIZE; index++)
{
printf("pointers +%d: value = %d ,address = %10p value = %.1f,address = %10p\n",index,*(pti+index),pti+index,*(ptf+index),ptf+index);
}
return0;
short double
pointers +0: value = 1 ,address = 0x7fff5fbff830 value = 1.1,address = 0x7fff5fbff800
pointers +1: value = 2 ,address = 0x7fff5fbff832 value = 2.2,address = 0x7fff5fbff808
pointers +2: value = 3 ,address = 0x7fff5fbff834 value = 3.3,address = 0x7fff5fbff810
pointers +3: value = 4 ,address = 0x7fff5fbff836 value = 4.4,address = 0x7fff5fbff818
*(dates+2) == dates[2] // 值相同
dates +2 == &dates[2] // 地址相同
*优先级 大于 +