Results 1 to 10 of 14

Thread: is it possible to hold different types of function pointers in a table(structure)

Threaded View

  1. #1
    Join Date
    Aug 2012
    Beans
    623

    is it possible to hold different types of function pointers in a table(structure)

    Hello,
    I want a design like

    Code:
    typedef struct _LOOKUP
    {
     char* FunctionSignature;
      DONTKNOW FunctionPointer;
    }LOOKUP;
    And I want to populate it something like,

    LOOKUP* ptr;
    ptr->FunctionSignature = "iic";//which is code for int fun(int, char);
    In that case, ptr->FunctionPointer = int (*fptr)(int, char);

    Thanks.

    PS : Assume my requirement is that, I want to use a function pointer depending on the function supplied as input by a user, and I want to call this function using a FunctionPointer which has been maintained in the LOOKUP table.
    Last edited by IAMTubby; March 25th, 2013 at 06:06 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •