C/C++ 利用宏参数创建字符串 发表于 2025-06-11 分类于 技术 阅读次数: 代码示例: 12345678910/* subst.c -- 在字符串中进行替换 */#include <stdio.h>#define PSOR(x) printf("The square of " #x " is %d\n", ((x)*(x)))int main(void){ int y = 5; PSOR(y); PSOR(2 + 4); return 0;} 运行结果为: 12The square of y is 25The square of 2 + 4 is 36