C stdrag.h Library Function: The C stdarg.h library function defines a variable type va_list and three macros which can be used to get the arguments in a function. When the number of arguments is not known as a variable number of arguments. A function of variable arguments is defined with the ellipsis (,…) at the end of the parameter list.
C stdrag.h Library Function
Library Variables
va_list : It is suitable for holding information needed by the three macros va_start(), va_arg() and va_end().
Library Macros
- void va_start(va_list ap, last_arg) : This macro initializes ap variable to be used with the va_arg and va_end macros. And the last_arg is the last known fixed argument being passed to the function i.e. the argument before the ellipsis.
- type va_arg(va_list ap, type): This macro retrieves the next argument in the parameter list of the function with type.
- void va_end(va_list ap): This macro allows a function with variable arguments that used the va_start macro to return. And the va_end is not called before returning from the function, the result is undefined.