The C language supports function that takes variable number of arguments using standard argument interface (stdarg.h). The following are the functions used to handle variable number of arguments in a function.

#include <stdarg.h>

void va_start(va_list ap, last);
type va_arg(va_list ap, type);
void va_end(va_list ap);
void va_copy(va_list dest, va_list src);

The prototype of a function which takes varying number of arguments will be similar to the following.

int max_of(int count,int num1,...);

It is declared similar to any other function but a “” is followed by fixed arguments representing the start of variable number of arguments. The varying number of arguments supplied to such function can More >