|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #include<stdio.h>
- #define PINTF(format,value) printf(" "format" \n",value)
-
- int main(){
-
- PINTF("%d",5);
-
- return ;
- }
复制代码
为什么 %d和format 要加上“”才能正常输出呢 ,不是直接替换吗
- #include<stdio.h>
- #define PINTF(format,value) printf(" format\n",value)
-
- int main(){
-
- PINTF(%d,5);
-
- return ;
- }
复制代码
这样都不行
把预处理器的结果输出出来看一下就明白了
- $ cat main.c
- //#include<stdio.h>
- #define PINTF(format,value) printf(" "format" \n",value)
- int main(){
- PINTF("%d",5);
- return ;
- }
- $ gcc -E main.c
- # 1 "main.c"
- # 1 "<built-in>"
- # 1 "<command-line>"
- # 1 "main.c"
- int main(){
- printf(" ""%d"" \n",5);
- return ;
- }
- $
复制代码
|
|