Facebook
From asdas, 6 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 81
  1. int suma(int n, int *t){
  2.     int suma=0;
  3.     for(int i=0;n>i;i++,*t++){
  4.         suma=suma+*t;
  5.     }
  6.     return suma;
  7. }
  8.  
  9.  
  10. int main()
  11. {
  12.     int t[3][3]={{11,12,13},{21,22,23},{31,32,33}};
  13.     size_t row = sizeof(t)/sizeof(t[0]);
  14.     size_t column = sizeof(t[0])/sizeof(t[0][0]);
  15.     int s[column];
  16.     int *w=t;
  17.     for(int i=0;i<column;i++){
  18.         s[i]=suma(row,w+row*i);
  19.     }
  20.     for(int i=0;i<column;i++){
  21.         printf("\n%d\t",s[i]);
  22.     }
  23.  
  24.     return 0;
  25. }