回覆列表
  • 1 # nrumt16574

    對於a[i][j](二維陣列的大小為n×m)而言,首先要搞清楚行指標和列指標行指標:&a[i]或者a+i指向行,&a[i]=&*(a+i)=a+i列指標:a[i]或*(a+i)指向列,a[i]等價於*(a+i)元素的引用方式有如下三種方式1.透過地址引用二維元素*(&a[i][j]),*(a[i]+j),*(*(a+i)+j),*(a[0]+m*i+j)*(&a[0][0]+m*i+j)(*(a+i))[j]2.建立一個指標陣列引用二維元素int *p[3],a[3][2],i,j;for(i=0;imain(){int score[][4]={{60,70,80,90},{56,89,67,88},{34,78,90,66}};int i,j;printf("輸入學生號:0-2");scanf("%d",&i);printf("the score of No.%d are:\n",i);for(j=0;jmain(){int a[3][4]={1,3,5,7,9,11,13,15,17,19,21,23};int *p;for(p=a[0];p

    main(){int score[][4]={{60,70,80,90},{56,89,67,88},{34,78,90,66}};int i,j; printf("輸入學生號:0-2");scanf("%d",&i);printf("the score of No.%d are:\n",i);for(j=0;jmain(){int score[][4]={{60,70,80,90},{56,89,67,88},{34,78,90,66}};int i,j,*p; printf("輸入學生號:");scanf("%d",&i);printf("the score of No.%d are:\n",i);for(p=score[i];p

  • 中秋節和大豐收的關聯?
  • 怎麼解決蘋果自拍臉歪?