C Programming :: Declarations and Initializations - Discussion
Home > C Programming > Declarations and Initializations > MCQs Questions Discussion
16 / 54
What is the output of the following C Program?
#include<stdio.h>
void main()
{
int a=4, b = 6;
printf ("%d", a==b);
}
#include<stdio.h>
void main()
{
int a=4, b = 6;
printf ("%d", a==b);
}
Aoutputs an error message
B0
C1
Dnone of these
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
STEP-BY-STEP
printf ("%d", a==b); It gives a boolean result i.e 1 for true and 0 for false. Since 4 is not equal to 6 hence output will be 0.
Read Full Answer
Report Error
Please Login First Click Here
STEP-BY-STEP
Here, a and b are initialized with 4 and 6 respectively. In the next line, the values of both a and b are compared with each other. Since 4 is not equal to 6, hence the result of this boolean operation is 0(meaning false). Therefore, the correct option is option B.
Read Full Answer
Report Error
Please Login First Click Here