正在加载图片...
使用指针引用数组元素 数组的方法 指针的方法 #include <stdio. h> #include <stdio. h> void maino void mal int a[5]={6,7.8,9,10} inta[!S]{6,78,9,10}; int 1 Int"p for(i=0;1<5;i++) for(p=a; p<a+5; p++) printf( %dn"*p) printf("a[%od %dn"i, aiD; 北大青鸟 P-使用指针引用数组元素 • 数组的方法 – #include <stdio.h> – void main() – { – int a[5]={6,7,8,9,10}; – int i; – for (i=0;i<5;i++) – { – printf("a[%d]:%d\n",i,a[i]); – } – } • 指针的方法 – #include <stdio.h> – void main() – { – int a[5]={6,7,8,9,10}; – int *p; – for (p=a;p<a+5;p++) – { – printf("%d\n",*p); – } – }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有