Machine-translated by Google. Questions are authored in English.
Top

Discussion

What will be the output of the following C code?

#include <stdio.h>
#define san 557
main()
{
    #ifndef san
    printf("yes");
    #endif
    printf("no");
}

 

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

Answer: C

Correct answer: no

san is defined, so #ifndef san is false and the printf("yes") between it and #endif is deleted before compilation. Only the unconditional printf("no") remains, so the output is no.

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

Post your comment

Please log in or register to post a comment.