#include<stdio.h>
#define max 10
int count,array[max];
largest(int num_array[],int lengh);
/* compare numder 这是对的 */
int main(void)
{
for(count=0;count<max;count++)
{
printf("input number: ");
scanf("%d",&array[count]);
}
printf("%d",largest(array,max));
return 0;
}
largest(int num_array[],int lengh)
{
int count,biggest=-1200;
for(count=0;count<lengh;count++)
{
if(biggest<num_array[count])
biggest=num_array[count];
}
return biggest;
}
==============================================
#include<stdio.h>
#define MAX 10
int count,array[MAX];
largest(int num_array[]);
int main(void)
{
for(count=0;count<MAX;count++)
{
printf("input number for comparing size");
scanf("%d",&array[count]);
}
printf("The biggest number is %d",largest(num_array[]));
return 0;
}
/* ===============未声明num_array[]变量=================================*/
largest(int num_array[])
{
int biggest=-888888 ;
for(count=0;count<MAX;count++)
{
if(biggest<num_array[count])
biggest=num_array[count];
}
return biggest;
}
================================
拒我观察,这两个不都在LARGEST函数中声明了吗?为什么后边那个就不行