passing functions or subroutines in a subroutine

From: Joel Smith (joelvsmith_at_earthlink.net)
Date: 07/28/04


Date: 28 Jul 2004 12:23:19 -0700

I'm working on a project where the structure of the program remains
the same over time, but the calculations change.

for instance, let's say the project looks like this

program main
...
   call calculation_1
   call calculation_2
   call calculation_3
   .
   .
   .
etc.

I'd like to pass the calculation subroutines a pointer that points to
a subroutine that has the current set of code that will do the work,
i.e.
calculation_1_v1 or calculation_1_v2
both of these subroutines will produce the same results, but as things
change i was just create a new subroutine and feed it into the
calculation subroutines. is this possible? does this sound like a
decent way to organize the project? I know this question may sound
vague. at the least if you have any information about feeding a
subroutine another subroutine, please pass it on. thank you.


Quantcast