The #ifndef directive in C

#include <stdio.h>
#define SOME_MACRO
int main()
{
#ifndef SOME_MACRO
    printf("Will not compiled\n");
#endif

#ifndef NO_MACRO
    printf("This one will be printed\n");
#endif
#ifndef NEW_MACRO
#define NEW_MACRO
    printf("Macro defined\n");
#endif

    return 0;
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *