#define中#和##的作用
来源:互联网 发布:淘宝tbi数据包怎么用 编辑:程序博客网 时间:2024/05/17 23:24
###Date:2017/9/29
在学习的过程中发现,宏函数的作用还是很大的。通过使用宏函数可以有效减少函数的声明。通过连接符##可以实现这一点。下面就记录一下#define中#和##的作用。
#:字符串化,宏定义中的#是把跟在后面的参数转成一个字符串;
##:连接字符串
例子:
#include <iostream>using namespace std;#define to_string(s) #s#define test_macro "hello"##"world"int main(int argc, char* argv[]){cout << to_string(Hello World!) << endl;cout << test_macro << endl;return 0;}
输出分别为:Hello World!
helloworld
参考:
http://blog.csdn.net/qq_15457239/article/details/56842450
http://www.cnblogs.com/little-ant/p/3463080.html
阅读全文
0 0
- #define中#和##的作用
- #define 中 # 和 ## 的作用
- #define中#和##的作用
- #define中#和##的作用
- #define中#和##的作用
- #define中#和##的作用
- #define中#和##的作用
- #define中#和##的作用
- #define中#和##的作用
- define中 #和##作用
- #define中#和##以及 #@的作用
- define中#的作用
- 简述PHP中define()和const的作用和差别
- stagefright中#define里的#和##的作用
- Linux编程中 #define _XOPEN_SOURCE的作用
- ecshop中define('IN_ECS', true)的作用
- ecshop中define('IN_ECS', true)的作用
- C++中 #ifndef #define #endif的作用
- js 文件上传
- mozilla pdfjs跨域问题及压缩优化
- 01.Jquery介绍和基本用法
- Codeforces 778A String Game
- gradle插件配置-eclipse
- #define中#和##的作用
- Hadoop Streaming
- 弹框表单通过Ajax进行数据绑定填充
- Spring MVC 更灵活的控制 json 返回问题(自定义过滤字段)
- Android的入口
- Windows Server搭建mysql数据库
- 关于thinkphp5的上传图片和ckeditor
- 常用sql整理
- 02.Jquery语法上