Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "..." mean in a C function declaration?

What does this mean?

void message(int x, int y, ...)

I can't understand what ... is. Can anybody explain?

like image 332
ambika Avatar asked Mar 03 '10 07:03

ambika


People also ask

What is the mean of function in C?

A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. Functions are used to perform certain actions, and they are important for reusing code: Define the code once, and use it many times.

What does 3 dots mean in C?

The three dots '...' are called an ellipsis. Using them in a function makes that function a variadic function. To use them in a function declaration means that the function will accept an arbitrary number of parameters after the ones already defined.

What is mean by function declaration in C?

A function consist of two parts: Declaration: the function's name, return type, and parameters (if any) Definition: the body of the function (code to be executed)

What are the three parts of a function declaration?

A function has three parts, a set of inputs, a set of outputs, and a rule that relates the elements of the set of inputs to the elements of the set of outputs in such a way that each input is assigned exactly one output.


1 Answers

... denotes a variable list of arguments that can be accessed through va_arg, va_end and va_start.

like image 177
Heinzi Avatar answered Sep 29 '22 04:09

Heinzi