How do I loop through a va_list if the number of additional arguments is unknown?
#include #include int add(int x, int y, ...
The two answers above that suggest adding a first argument to indicate the number of arguments miss the point: the number of arguments is unknown.
Using a sentinel value (or series of sentinel values) at the end is the only way to solve the problem.