當前位置:編程學習大全網 - 電腦編程 - C語言編程,題目1:定義壹個壹維數組,用指針引用的方法對該數組各元素賦值,然後輸出該數組。未完

C語言編程,題目1:定義壹個壹維數組,用指針引用的方法對該數組各元素賦值,然後輸出該數組。未完

題目1

void main()

{

int i;

char a[3];

*a=1;

*(a+1)=2;

*(a+2)=3;

for(i=0;i<3;i++)

{

printf("%d.\n",a[i]);

}

return;

}

題目二

#include<stdio.h>

void main()

{

int i,j;

int A[3][4]=

{

{1,2,3,4},

{5,6,7,8},

{9,10,11,12}

};

int (*p)[4]=A;

for(i=0;i<3;i++)

{

for(j=0;j<4;j++)

{

printf("%d.\n",*(*(p+i)+j));

}

}

return;

}

  • 上一篇:模具蛋糕有幾種和做法
  • 下一篇:北大青鳥消火栓按鈕兩個燈同時亮
  • copyright 2024編程學習大全網