Basic and Advance C Question: Download Questions PDF
How can I call a function with an argument list built up at run time?
Answer:
There is no guaranteed or portable way to do this.
Instead of an actual argument list, you might consider passing an array of generic (void *) pointers. The called function can then step through the array, much like main() might step through argv. (Obviously this works only if you have control over all the called functions.)
Instead of an actual argument list, you might consider passing an array of generic (void *) pointers. The called function can then step through the array, much like main() might step through argv. (Obviously this works only if you have control over all the called functions.)
Download C Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
Why is this loop always executing once? | I cant get va_arg to pull in an argument of type pointer-to-function. |