I have a problem with findMax function using recursive find max element in array (code C++):
void findMax (int& imax, int n, int* arr){
imax=arr[0]?arr[0]:0;
if(n > 0){
imax = std::max(arr[n],findMax(imax, n-1, arr)); // error here: No matching function for call to max???
}
}
can you explains why and solutions for me with this error?
Thanks,
findMaxreturns nothing.