Explain macro substitution directive?

Syntax: #define [ ,, …]
Here [,,…] is optional.

When you use this in the program then in the program this is called macro and #define directive only replaces the macro by before starting of actual compilation.

e.g :

#define pie 3.14
Void main()
{
float r=3,area;
area=3*r*pie;
printf(“%f”,area);
getch();
}


Before the starting of actual compilation an intermediate is formed which is :

We can see only in place of pie ,3.14 has pasted.
If
is very long or we want to write in next line ,end first line by \.

e.g :
#define word c is powerful
language.
MACRO FUNCTION:

No comments:

Post a Comment