码迷,mamicode.com
首页 > 其他好文 > 详细

字符串创建运算符#

时间:2014-09-06 22:30:54      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:使用   ar   sp   on   c   ef   har   bs   r   

#define show(name) showword(#name)

void showword(const char *s)

{

    printf("%s\n");

}

int main()

{

    show(ABC);

    return 0;

}

结果:ABC

运算符的作用是将ABC变为了"ABC",并以此为参数传给showword函数,这个运算符只能在宏定义中使用

字符串创建运算符#

标签:使用   ar   sp   on   c   ef   har   bs   r   

原文地址:http://www.cnblogs.com/johnsblog/p/3959883.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!