Content deleted Content added
→Variable number of parameters: tidy up |
|||
Line 34:
In the [[C (programming language)|C programming language]], an ellipsis is used to represent a [[variadic function|variable number of parameters]] to a [[function (programming)|function]]. For example:
:<code>
The above function in C could then be called with different types and numbers of parameters such as:
:<code>func("
and
:<code>func("input string %s, %f", "another string", 0.5);</code>
[[C99]] introduced macros with a [[variadic macro|variable number of arguments]].<ref>Working draft changes for C99 preprocessor synchronization - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm</ref>
As of version 1.5, [[Java (programming language)|Java]] has adopted this "varargs" functionality. For example:▼
:<code>public int func(int num, String... strings)</code>▼
[[
===Java===
▲As of version 1.5, [[Java (programming language)|Java]] has adopted this "varargs" functionality. For example:
▲:<code>public int func(int num, String... strings)</code>
===PHP===
|