如何将宏定义与字符串拼接

tech2023-11-10  88

1、##

#define SOFTWARE_VERSION "Software:V1.00"

#define HARDWARE_VERSION "Hardware:V1.00"

#define SYSTEM_VERSION SOFTWARE_VERSION##" "##HARDWARE_VERSION

2、空格

1》拼接两个宏定义

#define SOFTWARE_VERSION "Software:V1.00"

#define HARDWARE_VERSION "Hardware:V1.00"

#define SYSTEM_VERSION SOFTWARE_VERSION HARDWARE_VERSION

2》拼接一个宏定义和一个字符串

#define SOFTWARE_VERSION "Software:V1.00"

#define SYSTEM_VERSION SOFTWARE_VERSION "Hardware:V1.00"

最新回复(0)