fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int ROWS=7,COLS=5,a[ROWS][COLS],(*p)[COLS],i=3,y,x;
  6. for(y=0;y<ROWS;++y) for(x=0;x<COLS;++x) a[y][x]=10*(y+1)+x+1;
  7. for(y=0;y<ROWS;++y,printf("\n")) for(x=0;x<COLS;++x) printf("%3d",a[y][x]);
  8. printf("\n");
  9. for(p=&a[0];p<&a[ROWS];++p)
  10. {
  11. printf("%p %u %u\n",(void*)p,(unsigned)(void*)p,COLS*sizeof(int)+(unsigned)(void*)p);
  12. (*p)[i]=0;
  13. }
  14. printf("\n");
  15. for(y=0;y<ROWS;++y,printf("\n")) for(x=0;x<COLS;++x) printf("%3d",a[y][x]);
  16. return 0;
  17. }
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
 11 12 13 14 15
 21 22 23 24 25
 31 32 33 34 35
 41 42 43 44 45
 51 52 53 54 55
 61 62 63 64 65
 71 72 73 74 75

0xbfed9d70 3220020592 3220020612
0xbfed9d84 3220020612 3220020632
0xbfed9d98 3220020632 3220020652
0xbfed9dac 3220020652 3220020672
0xbfed9dc0 3220020672 3220020692
0xbfed9dd4 3220020692 3220020712
0xbfed9de8 3220020712 3220020732

 11 12 13  0 15
 21 22 23  0 25
 31 32 33  0 35
 41 42 43  0 45
 51 52 53  0 55
 61 62 63  0 65
 71 72 73  0 75