The ifdef directive makes substitutions based on whether a particular identifier is defined.


#define USD 1 // first of all we have defined a macro USD

#ifdef USD	       		// here preprocessor cheking,  if USD is defined or not
#define currency_rate 50     // if it's defined, currency_rate is equals to 50
#endif        			// end of ifdef, these three lines are finished now


int main()
	int rs;
	// currency_rate is defined in preprocessor, 
    // no need define (int currency_rate)
	rs = 10 * currency_rate;   
    printf ("%d\n", rs);
	return 0;

You may also like...