#include<stdio.h>
#define ROWS 3
#define COLS 5
void copy_arr(int rows, int cols, double ar[rows][cols],double b[rows][cols]);
void output_arr(int m,int n, double ar[m][n]) ;
int main(void)
{
double a[ROWS][COLS] = {
{1.1,2.2,3.3,4.4,5.5},
{6.6,7.7,8.8,9.9,10.10},
{11.1,12.2,13.3,14.4,15.5}
};
int rs,cs;
double varr[rs][cs];
printf("a[3][5]\n");
output_arr(ROWS,COLS,a);
printf("\n");
copy_arr(ROWS,COLS,a,varr);
output_arr(ROWS,COLS,a);
output_arr(ROWS,COLS,varr);
return 0;
}
void copy_arr(int rows, int cols, double ar[rows][cols],double b[rows][cols])
{
int j,k;
for(j = 0; j < rows;j++)
{
for(k = 0; k < cols; k++)
{
b[j][k] = ar[j][k];
}
}
}
void output_arr(int rows,int cols, double ar[rows][cols])
{
int i,j;
for(i = 0; i < rows; i++)
{
for(j = 0; j < cols; j++)
{
printf("%lf\t",ar[i][j]);
}
printf("\n");
}
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-53747.html