274 views
0 votes
0 votes
what is the output of the program?  

        void main()  

                       {  

                      static char x=1;    

                       if(!x) exit(1);    

                      main(x=!printf(“\n IS IT GOOD?\n”),printf(“%d”,x=(EOF|EOF&EOF)));        }  

 (A) –1 IS IT GOOD   (B) 1 IS IT GOOD   (C) 0 IS IT GOOD

1 Answer

2 votes
2 votes

The answer is (A) –1 IS IT GOOD

EOF is a macro which expands to an integer constant expression with type int and an implementation dependent negative value but is very commonly -1. So, x=(-1 | -1 & -1)= -1

Related questions