Top

Discussion

What will be the output of the following C code?

#include
#define san 10
main()
{
    #ifdef san
    #define san 20
    #endif
    printf("%d",san);
}

 

  • A.10
  • B.20
  • C.Error
  • D.1020

Answer: B

In the code shown above, if the identifier san is defined, then its value is redefined and changed to 20. It is then printed. Hence the output is 20.

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

Post your comment