va_start()
Reset a function's variable argument list to return the first argument
Syntax
va_start()
Parameter
This function does not have any input parameters.
Description
The va_start() function resets a variable argument list within a user-defined function statement so that the next va_arg() function call will return the first of the variable arguments. The va_start() function may be called multiple times within a function statement; each time it resets the variable argument list to return the first argument.
Example
The following is an example of the va_start() function:
function reset_args(...) {
term = va_start();
i = 0;
while (i++ <= 3) {
printf("argument %d is %d\n",i,va_arg(term));
}
printf("variable arguments reset . . .\n");
term = va_start();
printf("reset argument is %d",va_arg(term));
return;
}
function main() {
reset_args(100,110,120,130,140,150,160);
return;
}
term = va_start();
i = 0;
while (i++ <= 3) {
printf("argument %d is %d\n",i,va_arg(term));
}
printf("variable arguments reset . . .\n");
term = va_start();
printf("reset argument is %d",va_arg(term));
return;
}
function main() {
reset_args(100,110,120,130,140,150,160);
return;
}
The example produces the following output:
argument 1 is 100
argument 2 is 110
argument 3 is 120
variable arguments reset . . .
reset argument is 100
argument 2 is 110
argument 3 is 120
variable arguments reset . . .
reset argument is 100
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*