Top

Discussion

What will be the output of the following C code?

#include
#define san 557
main()
{
    #ifndef san
    printf("yes");
    #endif
    printf("no");
}

 

  • A.error
  • B.yes
  • C.no
  • D.yesno

Answer: C

The output to the above code will be no. Since we have used the preprocessor directive, #ifndef and defined the identifier san, “yes” is not printed. Hence only “no” is printed as output.

No comment is present. Be the first to comment.
Loading…

Post your comment