Created
June 25, 2010 19:41
-
-
Save manuel/453342 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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