Variadic Function

/vɛˈri.æd.ɪk/ · Noun · Development

Definitions

  1. A function that accepts a variable number of arguments, such as C's printf(), JavaScript's rest parameters (...args), or Python's *args. The mechanism varies by language — C uses va_list macros, while higher-level languages typically collect extra arguments into an array or tuple.

    In plain English: A function that can take any number of inputs instead of a fixed amount, like a method that adds up however many numbers you give it.

    Example: "printf is the OG variadic function — it figures out how many args you passed by parsing the format string."

Related Terms