Jump to content

C++ Language/ProgramFlow/Parameters/VariableNumberOfParameters

From Wikibooks, open books for an open world

This is the current revision of this page, as edited by SoftwareEngineerMoose (discuss | contribs) at 07:05, 21 February 2022 (Created page with "{{C++ Language}} A parameter's type could be <code>std::initializer_list<int></code>. This allows for passing either as <code>DoFunction({11,22,33})</code> or as <code>DoFunction(11,22,33)</code>. [https://www.youtube.com/watch?v=CIFIhzcvmUQ Additional information about having a variable number of parameters (includes interactive examples)] {{BookCat}}"). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A parameter's type could be std::initializer_list<int>. This allows for passing either as DoFunction({11,22,33}) or as DoFunction(11,22,33).

Additional information about having a variable number of parameters (includes interactive examples)