Initialize the variable-length argument list.
Compatibility:This function is compatible with the following targets:
|
EMB/RTOS
|
|
#include <stdarg.h>
void va_start(va_list ap, ParmN Parm);Parameters:
Parameters for this facility are:
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
void multisum(int *dest, ...);
int main(void)
{
int all;
all = 0;
multisum(&all, 13, 1, 18, 3, 0);
printf("%d\n", all);
return 0;
}
void multisum(int *dest, ...)
{
va_list ap;
int n, sum = 0;
va_start(ap, dest);
while ((n = va_arg(ap, int)) != 0)
sum += n; /* add next argument to dest */
*dest = sum;
va_end(ap); /* clean things up before leaving */
}
Output:
3
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000