I am trying to write a function to find the smallest value in an array, but i cannot figure out the error i have made. Can someone take a look at it? thanks!!!
void smallest(int array[],int size)
{
int smallest=array[0];
for (int i=1;i<size-1;i++)
{
if (array[i]<smallest)
smallest=array[i];
}
cout<<smallest<<'\n';
}
the code are not executed because there is breakpoint, and I cannot see where is the problem.