#include <stdio.h>
#include <stdlib.h>
#define M 9
#define PRINTF(FORMAT,VALUE)\
printf("the value is "FORMAT"\n",VALUE)
int main()
{
PRINTF("%d", M);
//printf("the value is ""%d""\n",9);
system("pause");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#define M 9
#define PRINTF(FORMAT,VALUE)\
printf("the value "#VALUE" is "FORMAT"\n", VALUE)
int main()
{
PRINTF("%d", M);
//printf("the value "M" is ""%d""\n",9);
system("pause");
return 0;
}
以上涉及到的 #VALUE即为宏中对应的参数
#include <stdio.h>
#include <stdlib.h>
#define PASTER(N)\
printf("token "#N" =%d\n",token##N)
int main()
{
int tokenN = 10;
PASTER(N);//printf("token N =%d\n",tokenN)
system("pause");
return 0;
}
以上涉及的##把俩边的符号连成一个符号