I wish to implement the following functionality:
int main() {
struct LeBigInt *x, *multiplicand, *addend;
/* Pointers are allocated and used here */
lbi_free(x, multiplicand, addend, result);
}
Looking at the varargs example on cppreference:
#include <stdio.h>
#include <stdarg.h>
int add_nums_C99(int count, ...)
{
int result = 0;
va_list args;
va_start(args, count); // count can be omitted since C23
for (int i = 0; i < count; ++i) {
result += va_arg(args, int);
}
va_end(args);
return result;
}
int main(void)
{
printf("%d\n", add_nums_C99(4, 25, 25, 50, 50));
}
I'm having trouble figuring out how to use the va_* functions provided to write a function that does not require passing in the number of arguments as the first argument.