pointers to pointers to functions

William J. Bouma bouma at cs.purdue.EDU
Fri Oct 13 03:03:26 AEST 1989


    I need a list of pointers to functions to be malloced. What is
    the syntax? I declared this thing to hold it:

         int (**f)();

    And then I tried mallocing some space for it like this:

         f = (int (**)()) malloc(n * sizof(*f));

    When the compiler hits that line I get this:

        illegal lhs of assignment operator
        unacceptable operand of &
        warning: illegal pointer/integer combination, op =
        cannot recover from earlier errors: goodbye!

    ?????? Also, C doesn't care if I call the function:

        (*f[x])();

   or

        (f[x])();

   ie. both of these work. Why? Is the first one the "correct" way?
-- 
Bill <bouma at cs.purdue.edu>  ||  ...!purdue!bouma 



More information about the Comp.lang.c mailing list