
recursive problem
hi
can anyone help me please
i want to write a recursive function that will find the minimum value of integer array and return this value the function takes an integer array and the array size as arguments.
i tried to solve it like this and it doesn't work so please tell me what is wrong?
int min(int a[] , int s) {
if ( s==1 )
return a[0];
else if( s>1){
if(min(a, s1) < a[s])
return min(a, s1);
else return a[s];
}
}

Code:
int min(int a[],int s){
if(s==1)return a[0];
return min(a,s1)<a[s1]?min(a,s1):a[s1];
}
but keep in mind (if this isn't for an assignment) that using recursion is not the best way to do this, just a regular linear search would be better.

Thanx
thanku Salem and thanku beeege
i appreciate your help
and i did it
thank god and thankyou it works
bye my friends