# include <stdio.h> # include <stdlib.h> # define M # define N int getdate(int (*sp)[M]){ int i,j,x; ;i<N;i++,j=){ while(j<M){ x=rand()%; ){ sp[i][j]=x;j++; } } } ; } int lineave(int s[][M],float a[]){ int i,j; float ave = 0.0; ;i<N;i
二维数组有两种形式: ①在栈上: int a[4][4] = {...}; ②在堆堆上: int ** a = new int *[4]; for(int i = 0; i < 4; i++) a[i] = new int[4]; 这两种情况下,二维数组做形参的传参方式是不一样的. ①在栈上时 void fun(int * a, int rownum, int colmunnum) //形参传递