Computer Sciences > Gate 2016 Set-2 > Functions
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) returns the maximum of x and y.

The value printed by this program is_________-

Correct : a

Similar Questions

The following function computes the maximum value contained in an integer array p[] of size n (n >= 1) int max(int *p, int n) { &nbsp; &nbsp; int a=0, b=n...
#123 MCQ
Consider the following C program. void f(int, short); void main() { &nbsp; &nbsp; int i = 100; &nbsp; &nbsp; short s = 12; &nbsp; &nbsp; short *p = &s; &...
#144 MCQ
Consider the following function implemented in C: void printxy(int x, int y) { &nbsp; &nbsp; int *ptr; &nbsp; &nbsp; x = 0; &nbsp; &nbsp; ptr = &x;...
#159 MCQ

Related Topics

No tags found

Unique Visitor Count

Total Unique Visitors

Loading......