请编写函数fun,该函数的功能是:将M行N列的二维数组中的数据,按列的顺序依次存放到一维数组中。函数fun中给出的语句仅供参考。
例如,二维数组中的数据为:
33 33 33 33
44 44 44 44
55 55 55 55
则一维数组中的内容应是:
33 44 55 33 44 55 33 44 55 33 44 55
注意:部分源程序在文件PROG1.C中。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
文件PROG1.C内容如下:
#include<stdio.h>
void fun(int(*s)[10],int *b,int *n,int mm,int nn)
/*以下代码仅供参考*/
int i,j,np=0; /*np用作b数组的下标*/
void main( )
int w[10][10]=33,33,33,33,44,44,44,44,55,55,55,55,i,j;
int a[100]=0,n=0;
printf("The matrix: \n");
for(i=0;i<3;i++)
for(j=0;j<4;j++)printf("%3d",w[i][j]);
printf("\n");
fun(w,a,&n,3,4);
printf("The A array: \n");
for(i=0;i<n;i++)printf("%3d",a[i]);
printf("\n\n");