Define Macro. How To Substitute The Macro Directives In Our Program?
3 years ago
C Programming
. Macro: – In c, the macro is used to define any constant value or any variable with its value in the entire program that will be replaced by the macro name. Where macro contains the set of code that will be called when the macro name is used in the program.
Substitute The Macro Directive In Our Program
The given example substitutes the macro in our program.
Ex –
#include<stdio.h>
#define A (2+3) // it macro
#define B (4+5) // it macro
Void main()
Int C;
C = A*B;
print(“C= %d”,C);
}
Output = 45
Rusma Khadka
Dec 27, 2022