使用指針輸出數組元素


 1 /* Note:Your choice is C IDE */
 2 #include "stdio.h"
 3 void main()
 4 {
 5   int a[10];//定義整型數組
 6   int *p,i;  //定義指針和變量
 7   puts("\nPlease input ten integer:\n");
 8   for(i=0;i<10;i++)
 9   scanf("%d",&a[i]);
10   printf("\n");
11   for(p=&a;p<(a+10);p++)
12   printf("%d\n",*p);
13 puts("\n\nPress any key to quit...");
14 getch();
15 return 0; 16 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM