Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2016 Set 2
Questions

Q37

NAT2 marksMedium

Consider the following program:

int f (int * p, int n)
{
    if (n <= 1) return 0;
    else return max (f (p+1, n-1), p[0] - p[1]);
}
int main ()
{
    int a[] = {3, 5, 2, 6, 4};
    printf(" %d", f(a, 5));
}

Note: max⁡(x,y)\max (x, y) returns the maximum of xx and yy. The value printed by this program is ________.

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.