下面这个程序运行时提示错误,怎么修改呢?
运行时提示错误:(1) 'fun' : cannot convert parameter 1 from 'int [19]' to 'int'This conversion requires a reinterpret_cast, a C-style cast or function-style cast
(2)'fun' : cannot convert parameter 1 from 'int [12]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
(3)'fun' : cannot convert parameter 1 from 'int [2]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
void fun(int,int,int);
int D[6];
void main()
{
int i;
int A[19]={3,4,6,7,8,9,11,13,14,15,16,18,19,20,24,27,28,29,33};
int B[12]={1,2,10,12,17,21,22,25,26,30,31,32};
int C[2]={5,23};
fun(A,19,3);
fun(B,12,2);
fun(C,2,1);
for(i=0;i<6;i++)
printf("%d\t",D[i]);
}
void fun(int a[],int m,int n){
static int i=0;
int j=0,k,t;
srand(time(NULL));
for(i;i<6;i++){
t=rand()%(m-j+1);
D[i]=a[t];
for(k=t;k<m-j-1;k++)
a[k]=a[k+1];
if(++j==n){
i++;
break;
}
}
}