相关疑难解决方法(0)

#define宏用于C中的调试打印?

尝试创建一个宏,可以在定义DEBUG时用于打印调试消息,如下面的伪代码:

#define DEBUG 1
#define debug_print(args ...) if (DEBUG) fprintf(stderr, args)
Run Code Online (Sandbox Code Playgroud)

如何用宏实现这一目标?

c c-preprocessor

196
推荐指数
7
解决办法
18万
查看次数

两个字符串文字的连接如何工作?

char* a="dsa" "qwe";
printf("%s", a);
Run Code Online (Sandbox Code Playgroud)

输出:dsaqwe

我的问题是为什么这件事有效.如果我在两个字符串文字之间给出一个空格或什么都没有,它会连接字符串文字.

这是怎么回事?

c string

24
推荐指数
3
解决办法
7799
查看次数

标签 统计

c ×2

c-preprocessor ×1

string ×1