Top

Discussion

What will be the output of the following C code?

#include
#define max 20
main()
{
    #ifndef max
    #define min 10
    #else
    #define min 30
    #endif
    printf("%d",min);
}

 

  • A.10
  • B.20
  • C.30
  • D.error

Answer: C

The output of the code shown above is 30. Since the identifier max is defined (the condition of #ifndef is true), hence another identifier, that is, min is defined and its value is equal to 30.

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

Post your comment