function casting

Robert P. Clark clark at umn-cs.CS.UMN.EDU
Sun Apr 30 08:55:23 AEST 1989


How do I cast something to a pointer to a function that returns
an integer?  I'm trying to save the old function, so that I can
call my own function and then chain to the original.


One of my (failed) attempts has been


main()
{
  int  (*f)();
  char *foo();


    f = ((*int)())foo();  /*  foo returns char*, but I know this is  */
                          /*  really an address of a function        */
}




                     Bob Clark        clark at umn-cs.cs.umn.edu

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~                                                       ~
    ~          Never underestimate the bandwidth of         ~
    ~          a station wagon  - Andrew Tannenbaum         ~
    ~                                                       ~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Comp.lang.c mailing list