宏定义
可变参数:__VA_ARGS__
1 #include <stdio.h> 2 3 #define print1(fmt, ...) 4 printf(fmt, ##__VA_ARGS__) //相当于直接替换...的内容 5 6 #define print2(...) 7 printf(__VA_ARGS__) //直接按默认规则帮你拼好字符串 8 9 int main() 10 { 11 print1("%s ", "hello"); 12 print2("%s ", "hello"); 13 } 14 15 输出: 16 hello 17 hello