TIP: Click on subject to list as thread! ANSI
echo: cis.os9.6809.coco
to: all
from: Joseph Cheek 71431,3466
date: 1992-03-31 09:58:53
subject: #more coco c programming

#: 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.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.