我正在打印一个字符串,例如:
printf("Print the number thirty: 30\n");
如果我做出以下定义
#define THIRTY 30
现在
printf("Print the number thirty: THIRTY");
C 预处理器是否会替换字符串中的 THIRTY --> 30
?
或者我必须去:
printf("Print then number thirty: %d", THIRTY);
最佳答案
C 预处理器不理解字符串内部的内容,因此不会操作字符串。
以下语句会将 THIRTY
替换为 30
printf("Print then number thirty: %d", THIRTY);
关于c - #define Printf() 字符串中的预处理器替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33010908/