#: 14739 S10/OS9/6809 (CoCo)
31-Mar-92 09:58:53
Sb: #more coco c programming
Fm: Joseph Cheek 71431,3466
To: all
Hello, C programmers!
I have another question. Suppose I have an array of pointers to functions,
such as the following:
int func0(), func1(), func2(), func3(), etc...;
int funcarr[] = {
func0,
func1,
func2,
func3,
etc... };
and I know which function I want to execute by its subscript in the array:
int whichfunc;
whichfunc = 1; /* I want to execute func1() */
It seems to me, from what James Jones said earlier to me, that the proper
statement would be:
(*funcarr[whichfunc])();
Is this correct? Are all of my previous statements syntactically correct?
Thank you for any replies.
There is 1 Reply.
|