Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void copy(int n, int m, double source[n][m]);
- void print_array(int n, int m, double target[n][m]);
- double array[3][5]={{1,2,3,4,5},{6,7,8,9,12},{15,16,17,18,19}};
- double target[3][5];
- int main(void){
- copy(3,5, array);
- print_array(3,5,target);
- return 0;
- }
- void copy(int n, int m, double source[n][m]){
- int rows, cols;
- for(rows=0; rows<n; rows++){
- for(cols=0; cols<m; cols++){
- target[rows][cols]=source[rows][cols];
- }
- }
- }
- void print_array(int n, int m, double target[n][m]){
- int rows, cols;
- for(rows=0; rows<n; rows++){
- for(cols=0; cols<m; cols++){
- printf("%.1f ", target[rows][cols]);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement