标题:宏定义中printf中的‘#’
只看楼主
wlhdhn
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-11-18
结帖率:50%
已结贴  问题点数:0 回复次数:2 
宏定义中printf中的‘#’
先看一例:
#include<iostream>
#include<cstdio>
using namespace std;
#define print(x) printf("the No. "#x", is ")
int main()
{
  print(10);//输出:the No. 10, is
  print("abc");//输出:the No. "abc", is
  print(abc);//输出:the No. abc, is
  int y=10;
  printf("#y");//输出:#y
  cout<<endl;
  return 0;
}
请问printf中的#在宏定义中起什么作用啊?

搜索更多相关主题的帖子: include 
2011-08-20 13:50
naruto01
Rank: 4
等 级:业余侠客
帖 子:103
专家分:280
注 册:2011-5-23
得分:15 
可以参考
http://blog.
2011-08-20 14:07
wlhdhn
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2009-11-18
得分:0 
谢谢楼上,弄懂了
2011-08-24 19:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-348010-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.792450 second(s), 10 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved