Sail E0 Webinar
Question


Point out the error, if any in the program.


#include<stdio.h>
int main()
{
int a = 10, b;
a >=5 ? b=100: b=200;
printf("%d\n", b);
return 0;
}
Options:
A .  100
B .  200
C .  Error: L value required for b
D .  Garbage value
Answer: Option C

Variable b is not assigned.

It should be like: 
b = a >= 5 ? 100 : 200;



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers