Variadic arguments
A variadic function or parameter accepts a variable number of arguments, often collecting the supplied values into a sequence of a specified type.
Modern C, Third Edition
A variadic parameter is the ellipsis-based parameter portion of a C function declaration that accepts additional arguments.
- How it is used
- Supports flexible interfaces such as printf and scanf, and serves as a standard C technique for type-generic interfaces.
- How deep it goes
- Defines ellipsis syntax, promotions, type conventions, portability hazards, and va_list operations, but does not detail their implementation.
- Examples
- Uses printf declarations, character promotion with %hhu, and nonportable format calls involving integer and pointer arguments.
- What you can do after
- Evaluate variadic interfaces by checking promotions, format conventions, portability, and the required va_list operations.
Read how Modern C, Third Edition explains variadic arguments →
Python How-To
args is the conventional parameter name for a function parameter that collects a variable-length sequence of positional arguments.
- How it is used
- Enables functions to accept an unknown number of positional arguments, including decorator wrappers used with differing calling signatures.
- How deep it goes
- Works through tuple packing and parameter placement, then applies variadic parameters to decorators without exploring interpreter internals.
- Examples
- Uses `print`, a string-conversion function, parameter-order calls, and a decorator that fails when its wrapper accepts no arguments.
- What you can do after
- Build it from scratch: define functions accepting variable-length positional arguments and choose explicit parameters when their number is known.
Python Workout, Second Edition
A variadic positional parameter collects an arbitrary number of positional arguments into a tuple.
- How it is used
- Handles functions that must accept a flexible number of positional arguments instead of multiple overloaded definitions.
- How deep it goes
- Defines tuple collection and iteration, then contrasts variadic parameters with defaults and keyword arguments; it stops short of deeper call mechanics.
- Examples
- Uses a custom summation function, optional XML content, keyword-generated XML attributes, and a generator that chains iterables.
- What you can do after
- Build it from scratch by collecting positional inputs, iterating over them, and selecting defaults or keyword arguments when the call pattern requires them.
Read how Python Workout, Second Edition explains variadic arguments →
Modern C
A variadic function is a C function that accepts a variable number of arguments through an ellipsis in its parameter list.
- How it is used
- Deploys variable-length interfaces such as printf and scanf, while contrasting them with safer variadic macros.
- How deep it goes
- Explains ellipsis syntax, default promotions, type contracts, and va_list traversal, but defers detailed implementation and discourages new use.
- Examples
- Uses printf format specifications, a counted double-summing function, and a debug-stream wrapper forwarding to vfprintf.
- What you can do after
- Operate stdarg interfaces with va_start, va_arg, and va_end, and diagnose mismatched format specifications or argument types.
100 Java Mistakes and How to Avoid Them
- How it is used
- Uses variable arity parameters to accept flexible argument lists while warning about array, collection, and null-call mistakes.
- How deep it goes
- Explains compiler-time wrapping, declared-type dependence, null behavior, collection nesting, and practical prevention; stops short of full overload-resolution treatment.
- Examples
- Uses `printAll`, an `Object`-typed array, null casts, and generic `contains` calls with a `List`.
- What you can do after
- Diagnose/debug ambiguous calls, unintended array nesting, null failures, and collections accidentally passed as single vararg elements.
Read how 100 Java Mistakes and How to Avoid Them explains variadic arguments →
Write Powerful Rust Macros
Variadic arguments are function-call arguments whose number is determined at the call site rather than fixed by the declaration.
- How it is used
- Simulates variadic arguments when Rust functions cannot accept a call-site-determined number of arguments.
- How deep it goes
- Demonstrates the function limitation and implements multiple macro call forms, but does not detail compiler internals.
- Examples
- Uses a vector macro and a greeting macro supporting a name alone or a name plus custom salutation.
- What you can do after
- Build it from scratch with a declarative macro that accepts multiple call forms and supplies a default argument.
Read how Write Powerful Rust Macros explains variadic arguments →
The Well-Grounded Python Developer: How the pros use Python and Flask
A variadic positional parameter is a function parameter that collects an arbitrary number of positional arguments.
- How it is used
- Collects a variable number of similar positional arguments for functions such as print.
- How deep it goes
- Defines the * syntax and tuple collection, then contrasts flexible argument lists with explicit named parameters.
- Examples
- Uses Python’s print function and a full_name function that joins one required name with collected additional names.
- What you can do after
- Build it into functions that accept multiple similar positional values while recognizing when named parameters communicate intent better.
Go by Example
A variadic function is a function that accepts a variable number of arguments through a variadic parameter represented inside the function as a slice.
- How it is used
- Improves CLI test helpers by accepting arbitrary command-line arguments while constructing a controlled test environment.
- How deep it goes
- Explains declarations, individual calls, slice expansion, local slices, and copying before modification.
- Examples
- Uses the `testRun` CLI helper, expanded argument slices, and prepended `hit` command arguments.
- What you can do after
- Apply it by writing helpers that accept separate values or expanded slices and pass those values into testable command execution.
Related concepts
- functionkind of · A function is a callable program unit that performs an operation, may accept inputs, and can produce a result or side effect.
- variadic macroalternative to · A variadic macro is a function-like C preprocessor macro whose parameter list accepts a variable number of arguments through an ellipsis.
- tupleproduces · A tuple is a finite, ordered collection of elements treated as a single composite value or record.
- va_startuses · va_start is a C and C++ macro that initializes a variable argument list for accessing a function’s variable arguments.
- splat operatorused by · A splat operator is language syntax that expands an iterable into multiple arguments or gathers multiple arguments into one parameter.
- positional argumentuses · A positional argument is a function argument associated with a parameter according to its ordinal position in the call rather than its name.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.







