当前位置:网站首页>C语言 #和##的使用
C语言 #和##的使用
2022-04-23 05:50:00 【tilblackout】
Linux源代码中偶尔会遇到#号,虽然很少用到,但还是做个笔记:
①#:对它所引用的宏变量左右各加上一个双引号
前提:
printf("123""456"); //printf是可以这样使用的,输出123456
例:
#define test(EXP) #EXP
printf("123"test(45)"6");//等价于printf("123""45""6");
②##:在带参数的宏定义中将两个子串(token)联接起来形成一个新子串(非字符串)。
- 子串:编译器能够识别的最小语法单元
#define test(n) a##n##c
int test(b)=123; #等价于int abc=123
printf("%d",abc); #输出123
版权声明
本文为[tilblackout]所创,转载请带上原文链接,感谢
https://blog.csdn.net/tilblackout/article/details/123419033
边栏推荐
猜你喜欢

copy constructor

for()循环参数调用顺序

cuda工程更换环境(电脑)后遇到的一系列编译问题

Cross domain issues - allow origin header contains multiple values but only one is allowed

Installation of GCC, G + +, GDB

MySQL groups are sorted by a field, and the first value is taken

Swagger2 generates API documents

基于VGG对五种类别图片的迁移学习

如何安装jsonpath包

【UDS统一诊断服务】一、诊断概述(2)— 主要诊断协议(K线和CAN)
随机推荐
Figure guessing game
clion安装教程
带默认模板实参的类模板与模板模板形参的匹配
共用数据的保护
类和对象的初始化(构造函数与析构函数)
日志写法(带时间)
【OpenCV】使用 FileStorage 读写 Eigen 向量
[untitled]
【UDS统一诊断服务】一、诊断概述(1)— 诊断概述
【UDS统一诊断服务】四、诊断典型服务(3)— 读故障信息功能单元(存储数据传输功能单元)
Detailed arrangement of knowledge points of University probability theory and mathematical statistics
Graduation project, curriculum link, student achievement evaluation system
sqlite3加密版
逻辑回归原理及代码实现
Jeu de devinettes
for()循环参数调用顺序
对象的动态建立和释放,赋值和复制
识别验证码
Programmers can also write novels
Uniapp encapsulates request