The stdarg.h header 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 are not known i.e. variable number of arguments.
Library Variables
va_list
This is a type suitable for holding information needed by the three macros va_start(), va_arg() and va_end().
Library Macros
This macro initializes ap variable to be used with the va_arg and va_endmacros. The last_arg is the last known fixed argument being passed to the function i.e. the argument before the ellipsis.
This macro retrieves the next argument in the parameter list of the function with type type.
This macro allows a function with variable arguments which used the va_startmacro to return. If va_end is not called before returning from the function, the result is undefined.
Không có nhận xét nào:
Đăng nhận xét