C/C++ macro string concatenation
问题 #define STR1 "s" #define STR2 "1" #define STR3 STR1 ## STR2 Is it possible to concatenate have STR3 == "s1"? You can do this by passing args to another Macro function. But is there a direct way? 回答1: If they're both strings you can just do: #define STR3 STR1 STR2 The preprocessor automatically concatenates adjacent strings. EDIT: As noted below, it's not the preprocessor but the compiler that does the concatenation. 回答2: You don't need that sort of solution for string literals, since they are