I have the following code

#define SWITCH(S) char *_S = S; if (0) #define CASE(S) } else if (strcmp(_S, S) == 0) {switch(1) { case 1 #define BREAK } #define DEFAULT } else {switch(1) { case 1 int main() { char buf[256]; printf("

String - Enter your string: "); scanf ("%s", buf); SWITCH (buf) { CASE ("abcdef"): printf ("B1!

"); BREAK; CASE ("ghijkl"): printf ("C1!

"); BREAK; DEFAULT: printf ("D1!

"); BREAK; } }

If I generate the pre-processor code with gcc -E , I will get the following code

int main() { char buf[256]; printf("

String - Enter your string: "); scanf ("%s", buf); char *_S = buf; if (0) { } else if (strcmp(_S, "abcdef") == 0) {switch(1) { case 1: printf ("B1!

"); }; } else if (strcmp(_S, "ghijkl") == 0) {switch(1) { case 1: printf ("C1!

"); }; } else {switch(1) { case 1: printf ("D1!

"); }; } }

But for some gcc defining char *_S = buf; in the middle of the code is not wolcome and could provide compilation error

How to fix that in my macro?