Question #201449

Read the following function and explain if this function finds the biggest value stored in
the array..
int biggest(int a[], int current_length)
{
int biggest = 0;
for (int i = 0; i < current_length; i++)
{
if (a[i] > biggest){
biggest = a[i];
}
}
return biggest;
}

Expert's answer

The function will only return the biggest value stored in the array if the array is filled with positive numbers. For an array of negative numbers, it will return 0.


LATEST TUTORIALS
APPROVED BY CLIENTS