A data type used to hold information about variable arguments passed to a variadic function. It is initialized with `va_start`, used with `va_arg`, and cleaned up with `va_end`.
1st Parameter
The `va_list` object to be cleaned up. It must have been initialized with `va_start` or `va_copy`.
Read more about parameters of va_end in parameters section
The va_endfunction in C language Ends traversal of the variable arguments, allowing a va_list to be reused.
va_end is a macro that facilitates a normal return from a function whose variable argument list was initialized by va_start or va_copy. It should be called on each va_list before the function returns or before calling va_start or va_copy again on the same va_list. After va_end is called, the va_list is undefined.
The va_endfunction takes 1
parameter:
•
va_list `ap`: The `va_list` object to be cleaned up. It must have been initialized with `va_start` or `va_copy`.
Ends the traversal of a variable argument list and performs necessary cleanup for the `va_list` object `ap`. It must be called after all arguments have been processed to avoid undefined behavior. No further operations should be performed on `ap` after `va_end` is called.
The va_end function return value :
None (void function)
Output
This example demonstrates the proper use of va_end in a variadic function that calculates the sum of its arguments.