What will be the output of the following C code? [code]#include<stdio.h> #define max 20 main() { #ifndef max #define min 10

Tiên Hương

New member
What will be the output of the following C code?
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
Explanation: 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.
 

Tìm kiếm

Back
Top