Functions

Q1:
What will be the output of the program?
#include<stdio.h>
int check (int, int);

int main()
{
    int c;
    c = check(10, 20);
    printf('c=%d\n', c);
    return 0;
}
int check(int i, int j)
{
    int *p, *q;
    p=&i;
    q=&j;
    i>=45 ? return(*p): return(*q);
}

A Print 10

B Print 20

C Print 1

D Compile error

ANS:A - Print 10

There is an error in this line i>=45 ? return(*p): return(*q);. We cannot use return keyword in the terenary operators.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.