标签:位置 隐式 printf code img [] 连续 src stdio.h
数组是相同类型的变量的有序集合
例子1:数组的初始化
#include<stdio.h>
int main()
{
int a[5] = {1,2};
int b[] = {1,2};
printf("a[2] = %d\n",a[2]);
printf("a[3] = %d\n",a[3]);
printf("sizeof(a) = %d\n",sizeof(a));
printf("sizeof(b) = %d\n",sizeof(b));
return 0;
}
例子2:数组和指针的不同
#include<stdio.h>
int main()
{
int a[5] = {0};
int b[2];
int* p = NULL;
p = a;
printf("a = %p\n",a);
printf("p = %p\n",p);
printf("b = %p\n",b);
return 0;
}
标签:位置 隐式 printf code img [] 连续 src stdio.h
原文地址:https://www.cnblogs.com/yanyun888/p/9213161.html