Say i have macro with x as string parameter #define a(x) "this is x". And if I call as a(test) , string formed should be "this is test".
1 Answer
You're looking forward to create strings from macro argument and so, are looking for # operator. Within the replacement part of a function-like macro, the # symbol becomes a preprocessing operator that converts tokens into strings. So you need
#define a(x) "this is " #x
or
#define a(x) "this is " #x " in the middle."
#define a(x) "this is " #x#define a(x) "this is " #x " macro"