A little knowledge of some of the macros in C language 1.# #和 #
C language, # #表示把两个宏参数贴合在一起, that is,
#define Call (x, y) x# #y, perform a call (x, y) result of XY, for example,
int x=2,y=5;
int xy=90;
printf ("%d\n", call (x, y));//result is 90
# #被称为连接符, used to concatenate two macro parameters into a single macro parameter.
The function of a single # is to string the macro arguments that follow it, simply by substituting a double quotation mark around the macro variable it refers to as a string.
The above quoted from Baidu know.
But it's like # #和 # can only be used in macro definitions
#include <iostream>#defineFun (b) a# #b#defineF (x) #xintMain () {intx =1; inty =2; intXY =5; Std::cout<<fun (x, y) <<"\ n"<<f (XY) <<":"<<xy<<Std::endl; Std::cin>>x; return 0;}
The result of the above code operation is:
5 XY: 5
Very interesting operator.
A little knowledge of some of the macros in C language