The following examples demonstrate the use of the # operator:
#define STR(x) #x #define XSTR(x) STR(x) #define ONE 1
| Invocation | Result of Macro Expansion |
|---|---|
"STR(\n "\n" '\n')" |
""\n \"\\n\" '\\n'"" |
"STR(ONE)" |
"ONE" |
"XSTR(ONE)" |
"1" |
"XSTR("hello")"
|
"\"hello\"" |
