Conditional Compilation using #ifdef #ifndef #undef C Pre Processor Directives

Source code for this Tutorial


#include <stdio.h>
#include <stdlib.h>

#define INTEL

int main()
{

    #ifdef INTEL
        printf("Code for INTEL MACHINES\n");
    #else
        printf("Code for non INTEL MACHINES");
    #endif // INTEL

    #undef INTEL

    #ifdef INTEL
        printf("Code for INTEL MACHINES\n");
    #else
        printf("Code for non INTEL MACHINES");
    #endif // INTEL

    return 0;
}