Use of #ifdef with #else


    #include <iostream.h>
    #include <conio.h>
    /* macro named 'print' is not defined */
    void main()
    {
        int a = 10 ;
        clrscr () ;
        a = a + 1 ;
        #ifdef print      /* if macro 'print' defined */
            cout << "a = " << a ;
        #else            /* if macro 'print' is not defined */
            cout << "The macro 'print' is not defined"  ;
        #endif
        getch () ;
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|