#include<iostream.h>
#include<conio.h>
#define MUL(a) a*a       //Macro Definition
inline int mul(int a)          //Inline Function Definition
{
                return(a*a);
}
void main()
{
                int x=5,y=5,p,q;
                clrscr();
                p=mul(++x);       //Inline Function Call
                q=MUL(++y);     //Macro Call
                cout<<"The Multiplication From Inline Function : "<<p<<endl;
                cout<<"The Multiplication From Macro : "<<q<<endl;
                cout<<"X : "<<x<<endl;
                cout<<"Y : "<<y<<endl;
                getch();
}

76

Advertisements