A Class of functions in c and c ++ contain a list of all uncertain parameters, such as the classic printf (char * format ,...). This article describes how to implement functions with variable-length parameters.
<Stdarg. h> contains a set of macro definitions that define how to traverse the parameter table.
There are four main types:
Va_list: Used to declare a variable. The variable references parameters in the parameter list in sequence, for example, va_list ap. The Suffix list should be a linked list.
Va_start: used to point the variables declared by the ap to the first unnamed parameter. Va_start (ap, the last famous parameter ). The Variable Length Parameter Function must contain a famous parameter.
Va_arg: return the parameter currently pointed to by the ap and ++ ap. Va_arg (ap, type)
Va_end: complete necessary cleanup.
From attacked Column