Sail E0 Webinar
Question


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);
}
Options:
A .  Print 10
B .  Print 20
C .  Print 1
D .  Compile error
Answer: Option D

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

 returnkeyword in the terenary operators.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers