#include<stdio.h>
void getMaxAndMin(int arr,int len,int*max,int*min);
int main()
{
int arr[] = {2,4,21,5,3,6,3,1};
int len = sizeof(arr)/sizeof(arr[0]);
int max = arr[0];
int min = arr[0];
getMaxAndMin(arr,len,&max,&min);
return 0;
}
void getMaxAndMin(int arr[],int len,int*max,int*min)
{
int i;
*max = arr[0];
*min = arr[0];
for(i=1;i<len;i++)
{
if(arr[i]>*max)
{
*max = arr[i];
}
if(arr[i]<*min)
{
*min = arr[i];
}
}
}
源码如上,想知道为什会报错啊
[Error] invalid conversion from 'int*' to 'int' [-fpermissive]