Hello All,
I'd like to call a function with this prototype:
with an array of ints. Kind of like this:Code:int make_sth(char *text, ...); /* expects a char * + a variable number of ints as args */
How can this be done without a switch, using some kind of loop?Code:int num_of_ints; int *some_ints; ..... /* set some_ints to point to num_of_ints ints */ switch(num_of_ints) { case 2: make_sth("a string", some_ints[0], some_ints[1]); break; case 3: make_sth("a string", some_ints[0], some_ints[1], some_ints[2]); ............................



LinkBack URL
About LinkBacks


