若x是一个宏参量,那么#x可以把参数转换为相应的字符串

example:

#include<stdio.h>

#define PSQR (x)  printf("the square of " #x " is %d.\n",((x)*(x)))

 

int main()

{

  int y = 5;

  PSQR (y);

  PSQR(2+4);

 

return 0;

}

result:

the square of y is 25.

the square of 2+4 is 64.