#define A_1 {2,1124,124110,2,0,20,5121,0,21241,10}
#define SFY(macro) #macro
void func(char* s, int i) {
printf("%d %s", i, s);
}
int main (void) {
int a[10] = A_1;
func(SFY(A_1), 2);
}
My desired output of this would be:
2 {2,1124,124110,2,0,20,5121,0,21241,10}
How can I stringify a macro like this?
You need to add one more layer of indirection in order to expand the macro (and since it contains commas, you must go variadic):
[Live example]