📅  最后修改于: 2020-12-19 06:09:01             🧑  作者: Mango
所述STDARG.H头文件定义的变量类型va_list的并且可以被用于获取在参数时的参数的数目是不知道的参数即变量数的函数三个宏。
变量参数的函数在参数列表的末尾用省略号(,…)定义。
以下是标头stdarg.h中定义的变量类型-
Sr.No. | Variable & Description |
---|---|
1 |
va_list This is a type suitable for holding information needed by the three macros va_start(), va_arg() and va_end(). |
以下是标头stdarg.h中定义的宏-
Sr.No. | Macro & Description |
---|---|
1 |
void va_start(va_list ap, last_arg)
This macro initializes ap variable to be used with the va_arg and va_end macros. The last_arg is the last known fixed argument being passed to the function i.e. the argument before the ellipsis. |
2 |
type va_arg(va_list ap, type)
This macro retrieves the next argument in the parameter list of the function with type type. |
3 |
void va_end(va_list ap)
This macro allows a function with variable arguments which used the va_start macro to return. If va_end is not called before returning from the function, the result is undefined. |