The 1.C standard library has a set of macros that can be used to create variable parameter functions (functions that accept a variable number of parameters)
Example:
#include <stdarg.h>//contains the stdarg.h header file, which handles variable parameter functions#include <stdio.h>voidPrint_ints (intargs,...);//after args is a mutable parameter{va_list ap;//va_list to save variable parametersVa_start (Ap,args);//explains where mutable parameters start inti; for(i =0; I < args;i++) printf ("ragument:%i\n", Va_arg (AP,int));//Va_arg accepts two values, va_list and parameter typesVa_end (AP);//with Va_end, tell C to finish.}voidMain () {print_ints (3, -,101, +);}
2.va_end, Va_start is a macro, not a function
3. variable parameter function must have ordinary parameters, so that his name can be passed to Va_start
4. Cannot exceed the number of functions given when reading a parameter
5. Need to know the type of parameter to read
Variable parameter functions