Important

   

This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 22.1 for BMC Helix Operations Management. Open link

va_start()

Reset a function's variable argument list to return the first argument

Note

The va_start() function is used only within user-defined function() statements that specify a variable list of arguments in the function() definition.

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;
}

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


Was this page helpful? Yes No Submitting... Thank you

Comments