16

Possible Duplicate:
What's does … mean in an argument list in C ?

 function fun1(...)
    {
    }

Please tell me about what is the use and how to use ellipsis operator in c. Thanks,

Community
  • 1
  • 1
Karandeep Singh
  • 1,223
  • 5
  • 22
  • 34
  • A good link for you: [here](http://bobobobo.wordpress.com/2008/01/28/how-to-use-variable-argument-lists-va_list/) – Benoit Sep 25 '10 at 06:29

1 Answers1

29

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:

format("%d-%d-%d", 2010, 9, 25);

and

format("product: %s, price: %f", "HDD", 450.90);

C99 introduced Variadic macros which also makes use of ellipsis.

Vijay Mathew
  • 26,737
  • 4
  • 62
  • 93