#define TRACE(S) (printf("%s\n",#S),S)是什么意思

来源:互联网 发布:linux分区方案 知乎 编辑:程序博客网 时间:2024/04/30 08:20
#include<iostream>#include<stdio.h>#include<string.h>using namespace std;#define TRACE(S) (printf("%s\n",#S),S)int main(){int a=10;int b=TRACE(a);const char *str="ni hao";char des[100];printf("dd");strcpy(des,TRACE(str));cout<<"b:"<<b<<endl<<"des:"<<des<<endl;return 0;}

结果:

a
str
b:10
des:ni hao


0 0