Advertisement
horselurrver

Copying again

Aug 4th, 2016
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. void copy_arr(double source[], double target1[], int num);
  3.  
  4. int main(void){
  5.     double source[][2]={{1,2},{3,90}};
  6.     double target[2][2];
  7.    
  8.     int rows,cols;
  9.     for (rows=0; rows<2; rows++){
  10.         copy_arr(source, target, 4);
  11.        
  12.     }
  13.    
  14.     for(rows=0; rows<2; rows++){
  15.         for(cols=0; cols<2; cols++){
  16.             printf("%f  ", target[rows][cols]);
  17.         }
  18.         printf("\n");
  19.     }
  20.     return 0;
  21. }
  22.  
  23. void copy_arr(double source[], double target1[], int num){
  24.     int i;
  25.     for(i=0; i<num; i++){
  26.         target1[i]=source[i];
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement