1. ## Nested Macros Evaluation??

Code:
```#include "stdio.h"
#define a(x,y) x##y
#define b(x) #x
#define c(x) b(x)
int main()
{
printf("%s\t",c(a(34,56)));
printf("%s\n",b(a(34,56)));
return 0;
}

Output:
3456 a(34,56)```
Doubt:
According to my understanding c(a(34,56)) should be expanded to c(3456) and then to b(3456) followed by "3456"
and b(a(34,56)) should be expanded to b(3456) followed by "3456". So the output should be:
3456 3456 but this is not so why?
If a statement contains a macro within macro then what would be the order of expansion in macros? Is it that first the inner one would be expanded followed by the outer one or vice versa?

2. No, because b() expands to the input as a string - not to the expansion of the input. The #x is the "magic" part here - the # means "immediately, translate x to a string", not "expand x, then translate to a string".

--
Mats

3. Thanks matsp..

Still i m having doubt....

Code:
```that means outerone will be exec'd first.. if so,

first one should also leads to a(34,56)... how 3456 is printed ??..

c(a(34,56)) =>b(a(34,56)) =>a(34,56)```

4. so in the c case, x is expanded before b() is expanded, which means that you get 3456 before you get to b().

--
Mats

5. Only one level of variable substitution is conducted at each expansion. This means that this:

Code:
```#define TEST foo
#define A(X) #X

A(TEST)```
Will expand to "TEST", not "foo". To expand to "foo" you must force another substitution:

Code:
```#define TEST foo
#define A(X) AA(X)
#define AA(X) #X

A(TEST)```
Now expands to "foo"