What is it called when you use object... as a parameter?

Asked
Viewd265

2

I have noticed in Java that you can have a function with object... as a parameter and then method will take any number of objects as a parameter and treat it as an array. What is this called? I have been trying to search for it but it seems ... is ignored by search engines. I seem to remember printf in C does the same thing.

Thanks.

4 ответов

7

It's called varargs

3

Wikipedia says this is called a variadic function.

1

It's called varargs.

It means is function is accepting variable number of arguments. In C/CPP there is a header file stdarg.h which have declaration of methods for handling variable arguments.

2

It's called varargs