- 616 名前:デフォルトの名無しさん [2007/12/15(土) 10:40:49 ]
- こんな感じなら理解できるか?
#include <stdio.h> #define N 5 void aryfunc(int ary[N][N]) { int *temp; for(temp = &ary[0][0]; temp != &ary[N-1][N]; temp++){ (*temp)++; } } int main() { int ary[N][N] = {{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15}, {16,17,18,19,20},{21,22,23,24,25}}; int *temp,i; for(temp = &ary[0][0],i = 1; temp != &ary[N-1][N]; temp++,i++){ printf("%d ",*temp); if(!(i%5)) putchar('\n'); } aryfunc(ary); for(temp = &ary[0][0],i = 1; temp != &ary[N-1][N]; temp++,i++){ printf("%d ",*temp); if(!(i%5)) putchar('\n'); } return 0; }
|

|