Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 在 C 的参数列表中……是什么意思?
function fun1(...) { }
请告诉我c中有什么用途以及如何使用省略号运算符。谢谢,
省略号用于表示函数的可变数量的参数。例如:
void format(const char* fmt, ...)
然后可以使用不同类型和数量的参数调用 C 中的上述函数,例如:
format("%d-%d-%d", 2010, 9, 25);
和
format("product: %s, price: %f", "HDD", 450.90);
C99引入了也使用省略号的可变参数宏。