I'd like to know if there is a way of iterating through a variable argument lisf without using the va_arg function. If so, can someone show me an example please?
CodePudding user response:
No, va_arg
is the only mechanism provided by standard C for iterating over variadic arguments.
There may be other ways on specific implementations (e.g. inspecting stack memory based on how an ABI defines its layout), but they will be non-portable, and there is rarely any good reason to use anything besides va_arg
.