Expand|Select|Wrap|Line Numbers
- #include <stdio.h>
- #define f(a,b) a##b
- #define g(a) #a
- #define h(a) g(a)
- int main()
- {
- printf("%s\n",h(f(1,2)));
- printf("%s\n",g(f(1,2)));
- return 0;
- }
Expand|Select|Wrap|Line Numbers
- 12
- f(1,2)
In short, in first printf()
h(f(1,2)) >> g("12") >> "12"
In the second printf(),
g(f(1,2)) >> "f(1,2)"
I'm not sure about this guesswork. Still some questions remain. Please put some light on it. How many passes does a C pre-processor performs? And exactly how it works? Please explain it.
Thank you.