Next: Null Pointer Constant, Previous: Consistency Checking, Up: Language Features [Contents][Index]
ISO C defines a syntax for declaring a function to take a variable number or type of arguments. (Such functions are referred to as varargs functions or variadic functions.) However, the language itself provides no mechanism for such functions to access their non-required arguments; instead, you use the variable arguments macros defined in stdarg.h.
This section describes how to declare variadic functions, how to write them, and how to call them properly.
Compatibility Note: Many older C dialects provide a similar, but incompatible, mechanism for defining functions with variable numbers of arguments, using varargs.h.
• Why Variadic: | Reasons for making functions take variable arguments. | |
• How Variadic: | How to define and call variadic functions. | |
• Variadic Example: | A complete example. |