让第一行为:
现在,我需要将它与一个字符串常量连接起来;就像这样:
#define TAG_LEN 32
现在,我需要将它与一个字符串常量连接起来;就像这样:
puts("Blah" [insert your answer] TAG_LEN); // I need "Blah32".
#define TAG_LEN 32
puts("Blah" [insert your answer] TAG_LEN); // I need "Blah32".
#define STR_NOEXPAND(tokens) # tokens
#define STR(tokens) STR_NOEXPAND(tokens)
puts("Blah" STR(TAG_LEN));
你可以做:
printf("Blah%d", TAG_LEN);
或者如果你有一个字符串
char *yourString;// initiate it with your value
printf("Blah%s%d",yourString, TAG_LEN);