For example, I saw source code like the following. Can we use #define in a function? How does it work? (more information: this code is what I copied from
You can use it inside a function, but it is not scoped to the function. So, in your example, the second definitions of a macro will be a redefinition and generate an error. You need to use #undef to clear them first.