Macro with Arguments


    #include <iostream.h>
    #include <conio.h>
    /* macro definition */
    #define xyz(a)        b = a * 2 ;
    void main()
    {
        int x = 3, b ;
        clrscr () ;
        xyz ( x ) ;                 /* call to macro 'xyz' */
        cout << "After first call to the macro 'xyz'...\n" ;
        cout << "b ="  << b ;
        xyz ( x + 5 ) ;          /* call to macro 'xyz' */
        cout <<"\n\nAfter second call to the macro 'xyz'...\n";
        cout << "b = " << b ;
        getch () ;
    }

0 comments:

Post a Comment

 
 
 
 


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