超简单的define,居然不会写
#define HELLO(x) \
"hello world(x) " \
" (x) is a fool; "
int main()
{
char *c = HELLO( "blue ");
printf( "%s ",c);
我期望输出 "hello world blue blue is a fool; "
}
如何搞?
[解决办法]
#define HELLO(x) "hello world " x " " x " is a fool; "
[解决办法]
#define HELLO(x) "hello world " x " " x " is a fool; "
"hello world " <==> "hello " " world "
[解决办法]
#include <stdio.h>
#define HELLO(x) "hello world "##x## " "##x## " is a fool; "
int main()
{
char *c = HELLO( "blue ");
printf( "%s\n ",c);
return (0);
}