| |||||
Technical Support On-Line Manuals Cx51 User's Guide | #defineThe #define directive defines a preprocessor macro. #define macro-name « (arg« , arg ... ») » replacement-text You may use #define to create function-like macros with or without arguments. Macros are syntactically similar to function calls. When a defined macro is encountered in the source file, the macro-name and any arguments are replaced by the replacement-text. For example:
#define my_macro(a,b,c) a+b+c
int func (int x, int y, int z)
{
return(my_macro(x,y,z));
}
appears as follows after macro expansion:
int func (int x, int y, int z)
{
return(x+y+z);
}
Refer to Macros for a complete description of how to define and use macros in your C programs. | ||||
| |||||