Something interesting about the MACRO in C Programming
This Afternoon I continued the learning of the macro. Using the same PPT demonstrated during the class on Tuesday, I think I’ve get more:
So, I’d like to record something.
It is mainly about #define
.
#define
This will definitely make programming more efficient.
There are two basic types of macro:
#define MACRO String
This type of macro is quite simple, it just replace “Macro” with “String” in your code.
#define MACRO(argument1, argument2, …) String containing the arguments
This type of macro is more like a function.
But keep in mind that this is not a function, and what is does is still the replacement of strings in your code.
What’s more, users should beware of the returning value.