+ 1

Find it

#include <stdio.h> int main() { int null=NULL; if(null=0) { printf("Hello\n"); } else { printf("World\n"); } } Option: A) Hello B) World C) No output D) error

28th Jun 2019, 5:43 PM
Srinath Manoharan
Srinath Manoharan - avatar
2 Answers
+ 6
It will print "World". null=0 is assignment, not equality check (that would be null==0). null=0 assigns 0 to "null" and returns 0. 0 = false => else branch is executed
28th Jun 2019, 5:52 PM
Anna
Anna - avatar
0
First obeject isn't correct because (null==0) ; =false; the second condition is automatically execute Ans will be World.
29th Jun 2019, 4:44 AM
Jeetu Kumar
Jeetu Kumar - avatar