3

让第一行是:

#define TAG_LEN 32

现在,我需要将它与文字字符串常量连接起来;类似的东西:

puts("Blah" [insert your answer] TAG_LEN); // I need "Blah32".
4

2 回答 2

3
#define STR_NOEXPAND(tokens) # tokens
#define STR(tokens) STR_NOEXPAND(tokens)
puts("Blah" STR(TAG_LEN));
于 2015-01-08T16:28:08.887 回答
0

你可以做:

printf("Blah%d", TAG_LEN);

或者如果你有一个字符串

char *yourString;// initiate it with your value

printf("Blah%s%d",yourString, TAG_LEN);
于 2013-09-02T13:35:14.530 回答