#,##只能在宏定义中使用
参考:
小知识:C语言宏定义中 # 和 ## 符号的用法_######-CSDN博客https://blog.csdn.net/little_grapes/article/details/123834446串联(C 预处理器) (gnu.org)https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html
#include <stdio.h>
#include "stdlib.h"
void quit_command(void)
{}
void help_command(void)
{}
struct command
{
char *name;
void (*function) (void);
};
struct command commands[] =
{
{ "quit", quit_command },
{ "help", help_command },
};
int main()
{
/* Write C code in this online editor and run it. */
printf("%s \n", commands->name);
#define COMMAND(NAME) { #NAME, NAME ## _command }
struct command commands_user[] =
{
COMMAND (quit),
COMMAND (help),
};
#undef COMMAND
printf("%s \n", commands_user->name);
return 0;
}