Example of Macro and Pre -Processor Directives
#include <iostream>
using namespace std;
int main()
{
#define sum a+b
int a=10, b=20,c;
#ifdef sum
c=sum*2;
cout<<c<<endl;
#endif
#ifndef sum
cout<<"Sum is not defined"<<endl;
#endif
return 0;
}
#include <iostream>
using namespace std;
int main()
{
#define sum a+b
int a=10, b=20,c;
#ifdef sum
c=sum*2;
cout<<c<<endl;
#endif
#ifndef sum
cout<<"Sum is not defined"<<endl;
#endif
return 0;
}
No comments:
Post a Comment