I have an interface documented as follows:
typedef struct Tree { int a; void* (*Something)(struct Tree* pTree, int size); };
Then, as I understand it, I need to instantiate this object and use the Something method to put the value for 'size'. Therefore i do
struct Tree *iTree = malloc(sizeof(struct Tree)); iTree->Something(iTree, 128);
But it cannot be initialized. Am I doing it right? Howcome the first member of the Something method is a pointer to the same structure?
Can someone please explain?
thanks
source share