Pointers to Functions
Martin M Lacey
martinl at molihp.UUCP
Wed Jan 15 09:55:06 AEST 1986
In article <59 at andromeda.UUCP> dave at andromeda.UUCP (Dave Bloom) writes:
><>
>Here's a good(?) question. Lets say I have this:
>
>main()
>{
> int a(), b(); /* defined somewhere else */
> int (*c)(); /* a pointer to a function returning int (K&R pg141) */
> .
> .
> .
> c = b;
> (*c)(some arguments);
>}
>
>Our compiler claims c is an "illegal function",
> [...]
>Looks like I'm missing something. Can anyone out the lend me a hand???
>What is it that's wrong in example one? How can I declare a generic pointer
>to an int-function, set it equal to the address of a valid int function,
>and use it instead of the function????
>
>Thanx.
>--
> Dave Bloom
I have just tested the above on our system (Sys 5 rel 2: HP9000 series 500)
and it works no problem. Your compiler is out-dated probably.
Magic Martin.
More information about the Comp.lang.c
mailing list