首页 > 代码库 > 数组和指针

数组和指针

原文:7.2数组和指针

#include<stdio.h>int main(void){    long multiple[]={15L, 25L, 35L, 45L};        long *p=multiple; //把p设置为multiple的地址,为什么不是multiple的值         for(int i=0;i<sizeof(multiple)/sizeof(multiple[0]);++i)            printf("address p+%d(&multiple[%d]):%llu *(p+%d) value:%d\n",i,i,(unsigned long long)(p+i),i,*(p+i));                printf("\n type long occupies: %d butes\n",(int)sizeof(long));            return 0;} 

 

数组和指针