C Programming :: Declarations and Initializations

8. What is the output of the following 'C' program?

#include
void main() {
int x = 10,y = 10, z = 5, i;
i = x;
printf("%d",i==x);
}

Answer: Option A

Explanation :

The value of x initialised is 10. Also i=x so i=10. Now when comparing condition  (i==x) it will give boolean result that is if the condition is true it will return 1 else it will return 0. So here the condition is true coz x=i hence output is 1.



 

Post Your Answer Here:     

Reply     |    Rate This: +0 -0      |     Report     |     To Reading List



Report Error

Please Login First Click Here

Reply     |    Rate This: +0 -0      |     Report     |     To Reading List



Report Error

Please Login First Click Here

Reply     |    Rate This: +0 -0      |     Report     |     To Reading List



Report Error

Please Login First Click Here