Answer the question
In order to leave comments, you need to log in
Pure C and variable number of arguments?
In general, I want to solve such a problem for myself in pure C, in order to initialize any structures with one function, here is my plan to write a function that would take void * as the first argument and then there was a list of arguments and I just added them to the pointer by offset, but I don’t know how implement it. The goal of my task is to master macros, I started that __va_args__ receives a variable number of arguments passed to the macro, but how to pull out the elements one by one?
Answer the question
In order to leave comments, you need to log in
Working with arguments usually goes through va_start / va_arg / va_end. But you still need to somehow pass in the types of the structures, as printf() does, for example, or store their descriptions in some format and pass them in.
The goal of my task is to master macros
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question