LEARN MORE ABOUT # define AND # include
Although you have been using #define and # include for some time .both have more features than you’ve read about so far .Each is examined here in detail.
In addition to using #define to define a macro name that will be substituted by the character sequence associated with that macro, you can use #define to create function-like macros. In a function-like macro, arguments can be passed to macro when it is expanded by the preprocessor. For example, consider this program.
#include<stdio.h>
#define SUM(i , j) i*j
int main(void){
int sum;
sum = SUM(10, 20);
printf("%d", sum);
return 0;
}
By the preprocessor. As you can see, the values 10 and 20 are automatically substituted for the parameters I and j.
LEARN MORE ABOUT # define AND # include
Reviewed by Pronce
on
January 31, 2017
Rating:
Reviewed by Pronce
on
January 31, 2017
Rating:
No comments: