我发现了有关How do I #define multiple values C / C++的一些相关问题。但是那不是我想要的。相反,我想做相反的事情。
我们可以简单地分配这样的内容
int a,b,c,d,e;
a = b = c = d = e = 5;
printf("Value %d",e);
但是我正在寻找的是如何在给定修复值的情况下将下面的定义合并到一行中。
#define SIZE_OF_NODE_ADD 4
#define SIZE_OF_KEY_ADD 4
#define SIZE_OF_ID_ADD 4
#define SIZE_OF_PW_ADD 4
可以这样做吗?类似于
#define SIZE_OF_NODE_ADD = SIZE_OF_KEY_ADD = SIZE_OF_ID_ADD = SIZE_OF_PW_ADD = 4
/* The syntax is wrong, I just emphasize for easier understanding what I am looking for*/
在C标准中,预处理器语句由换行符终止,因此您必须执行:
#define SIZE_OF_NODE_ADD 4
#define SIZE_OF_KEY_ADD 4
#define SIZE_OF_ID_ADD 4
#define SIZE_OF_PW_ADD 4
不允许使用多重定义语句。(甚至很难阅读)