Length of the function parameters
#include <stdio.h>
#include <stdarg.h>
void print_message(char *format, ...);
int main(void)
{
print_message("Cannot open file %s.", "test");
return 0;
}
void print_message(char *format, ...)
{
va_list ptr; /* get an arg ptr */
/* initialize ptr to point to the first argument after the
format string
*/
va_start(ptr, format);
/* print out message */
vprintf(format, ptr);
va_end(ptr);
}
Related examples in the same category