Differences between macros and functions in C Language
I. Code Length: the macro is completely replaced and inserted into the program to make the code longer. The function code only appears in one place and is called there when used. Ii. execution speed: the macro is faster, because it has been completed in the pre-compilation phase; the function is a little slower, because the additional time needed to call and return (pressure stack/out stack. 3. Operator priority: When a macro is present, parentheses are left blank, leading to a computing logic error. The function only returns the value at last, making the result easy to predict. Iv. parameter evaluation: the macro needs to be calculated every time. The function only needs to be calculated once. Subsequent calls do not cause multiple value calculation errors. 5. Parameter type: a macro does not care about the type, as long as the parameter operation is valid. The function types must be consistent, and different functions are required for different types.