void (*Problem)() = VoidFun;

wrc at brunix.UUCP wrc at brunix.UUCP
Sat Apr 20 13:35:56 AEST 1985


Expires:
References:
Sender:
Keywords:

Can anyone explain this problem with void?  I give a parallel example
with pointers to functions returning ints just as an example that
works.  I don't understand why you can't have a pointer to a function
returning void.

int IntFun() { puts("int"); return (5); }
void VoidFun() { puts("void"); }
int main()
{
    int (*IntPoint)(), i;
    void (*VoidPoint)();

    IntPoint = IntFun;
    VoidPoint = VoidFun;
/* cc and lint: "foo.c", line 10: operands of = have incompatible types */

    i = (*IntPoint)();
    (*VoidPoint)();
    }



More information about the Comp.lang.c mailing list