注册 登录
编程论坛 VC++/MFC

宏定义中printf中的‘#’

wlhdhn 发布于 2011-08-20 13:50, 974 次点击
先看一例:
#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中的#在宏定义中起什么作用啊?

2 回复
#2
naruto012011-08-20 14:07
可以参考
http://blog.
#3
wlhdhn2011-08-24 19:13
谢谢楼上,弄懂了
1