Discussion :: C Preprocessor - Yes / No Questions (Q.No.5)
|Sonalia said: (Dec 30, 2011)|
|Can anyone explain in details?|
|Sandeep Barnwal said: (May 24, 2014)|
|Yes, #ifdef NOTE is true if NOTE is defined as macro somewhere in program. Here, NOTE is not defined anywhere so, #ifdef returns false and else statement gets executed.
Hence, 20 will be printed.
#define Note 1
As we can see macro foe NOTE is defined, #ifdef will return true and 10 will be output.
#ifdef only looks for the macro definition.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.