相关疑难解决方法(0)

如何在c中将枚举名称转换为字符串

是否有可能将枚举器名称转换为C中的字符串?

c string enums

82
推荐指数
5
解决办法
9万
查看次数

字符串化 - 它是如何工作的?

我知道:

#define foo 4  
#define str(s) #s
Run Code Online (Sandbox Code Playgroud)

str(foo)写出:"foo"因为字符串化的第一个文本扩展的执行,但这样的:

 #define xstr(s) str(s)
 #define str(s) #s
 #define foo 4
Run Code Online (Sandbox Code Playgroud)

xstr(foo)写出:"4".

为什么?该过程涉及哪些步骤?

c c++ stringification c-preprocessor

50
推荐指数
2
解决办法
3万
查看次数

标签 统计

c ×2

c++ ×1

c-preprocessor ×1

enums ×1

string ×1

stringification ×1