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 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

Correct answer: 30

max is defined, so #ifndef max is false and the #else branch is taken, defining min as 30. The program prints 30.

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

Post your comment

Please log in or register to post a comment.