pointers to functions

Donald E Bruey bruey at cpsin3.cps.msu.edu
Sun Feb 4 06:11:56 AEST 1990



Is it dumb question time already this year?  Well, since someone has
to ask the first one, it may as well be me.     
 
Can some gracious .netlander please mail me some hints ( a program 
is also quite acceptable) on passing around pointers to functions?
Specifically, I've been doing a lot of numerical methods in programs
and having to call four or five functions in each program.  I don't
want to have to copy the code five times, as in




             if (count = /* value */) then do this function
        else if (count = /* another value */) then do _this_ functino
         etc

        I would rather call it like this

        subroutine ( pointer_to_function,initial_value);
        subroutine ( pointer_to_function_II, initial_value);

   and so on.  this would make my life a lot easier, but I found K&R
   a bit difficult to understand on this issue (surprise!!).  Can anyone
   help me?  Thanks in advance.

  If you do send something, mail is much more reliable than reply. 


  bruey at cpsin3.cps.msu.edu  or even bruey at cpsvax.egr.msu.edu

  



More information about the Comp.lang.c mailing list