English
Language : 

CC78K0S Datasheet, PDF (156/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 9 PREPROCESSING DIRECTIVES (COMPILER DIRECTIVES)
(7) #define ( ) directive
Macro Replacement
#define ( )
FUNCTION
The function-form #define directive replaces the identifier specified in the function format with a given
replacement list whenever the same identifier appears in the source code after definition by this directive.
Function-form macro replacement also includes replacing argument.
SYNTAX
#define identifier ( identifier list ) replacement-list new-line
EXAMPLE
#define F(n) (n*n)
void main(){
int i;
i=F(2)
}
EXPLANATION
In the above example, #define directive will replace “F(2)” with “(2*2)” and thus the value of i will become 4. For
the sake of safety, be sure to enclose the replacement list in parentheses, because unlike a function definition,
this function-form macro merely replaces a sequence of characters.
156
User’s Manual U14872EJ1V0UM