What is the effect of this function below assuming that a is
What is the effect of this function below, assuming that \"a\" is an array containing \"n\" values? int f (int a [], int n) {int temp, i, z = 0; for (i = 0; i
Solution
//This function takes the array as input, and will count all the elements
//that are less than the last element in the array, and returns the count.
int f(int a[], int n)
{
int temp, i, z = 0;
for(i = 0; i < n-1; i++) //For each element from first element till penultimate element.
{
if(a[i] < a[n-1]) //If the element is less than the last element.
z++; //Increment the counter.
}
return z; //Returns the count.
}
