recursive find of the smallest member..
i wrote a function that finds recursively the smallest member in an int array
and it says that "min is being used without being defined"
i cant put a value into min
i need to get it from the process.
??
Code:
#include <stdio.h>
int recFindMin (int array[] ,int index);
int main()
{
int t,array[3];
array[0]=2;
array[1]=1;
array[2]=3;
t=recFindMin(array,2);
printf("%d\n",t);
return 0;
}
int recFindMin (int array[] ,int index)
{
int min,local;
if (index==0)
{
return array[index];
}
local=recFindMin (array ,index-1);
if (array[index]>local)
{
min=local;
}
return min;
}//end func