Conditional Compilation Macros





This video tutorial explains the conditional compilation macros such as #if, #endif, #elif, #else in c++ programming.

You are gonna learn what are conditional compilation macros and what is the use of them, how use conditional compilation macros in your program in detail with example.

source code for this tutorial

#include <iostream>
#define WINDOWS 1
#define LINUX 2
#define MAC 3

#define OS LINUX

using namespace std;

int main()
{
#if OS == WINDOWS
    cout << "u are using windows"<<endl;

#elif OS == MAC
    cout << "mac user"<<endl;
#else
    cout << "linux user"<<endl;
#endif

    cout << "ha ha ha";
    return 0;
}