Skip to content

Instantly share code, notes, and snippets.

@manuel
Created June 25, 2010 19:41
Show Gist options
  • Save manuel/453342 to your computer and use it in GitHub Desktop.
Save manuel/453342 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define CALL(name, ...) \
{ \
int the_args[] = { __VA_ARGS__ }; \
name(sizeof(the_args) / sizeof(int), the_args); \
}
void the_fun(unsigned nargs, int *args)
{
printf("num of args: %d\n", nargs);
for (int i = 0; i < nargs; i++) {
printf("arg %d: %d\n", i, args[i]);
}
}
main()
{
CALL(the_fun, 1, 2, 3, 4);
CALL(the_fun, 23, 77);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment