C语言 什么是c中的省略号运算符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3792761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is ellipsis operator in c
提问by Karandeep Singh
Possible Duplicate:
What's does … mean in an argument list in C ?
可能的重复:
在 C 中的参数列表中……是什么意思?
function fun1(...)
{
}
Please tell me about what is the use and how to use ellipsis operator in c. Thanks,
请告诉我什么是用途以及如何在c中使用省略号运算符。谢谢,
回答by Vijay Mathew
An ellipsis is used to represent a variable number of parameters to a function. For example:
省略号用于表示函数的可变数量的参数。例如:
void format(const char* fmt, ...)
The above function in C could then be called with different types and numbers of parameters such as:
然后可以使用不同类型和数量的参数调用上述 C 中的函数,例如:
format("%d-%d-%d", 2010, 9, 25);
and
和
format("product: %s, price: %f", "HDD", 450.90);
C99introduced Variadic macroswhich also makes use of ellipsis.
C99引入了Variadic 宏,它也使用了省略号。

