You cannot create a function at runtime in C; the number of parameters should be known at compile time.
You can use a variable function to pretend that you have a function with any number of arguments (I included this use in a recent project ), but it may not be portable and probably Undefined Behavior.
If you need to move arguments between functions where signatures and arguments are not known before execution, you will almost certainly want to learn libffi.
Mike Ash has some really useful posts about this: http://www.mikeash.com/pyblog/?tag=libffi that I started and learned most of what I know about it.
source share