Expand macros inside quoted string [duplicate]

妖精的绣舞 提交于 2019-11-30 10:54:27
tomahh

You can't expand macros in strings, but you can write

#define COLOR "#00ff00"

f("abc "COLOR);

Remember that this concatenation is done by the C preprocessor, and is only a feature to concatenate plain strings, not variables or so.

#define COLOR "#00ff00"
f("abc "COLOR);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!