I am trying to create a linked list in C but trying to pack it nicely in somewhat of a C++ style class. I am having some issues however using function pointers in C.
<
You need to assign the function to the member. i also recommend giving them different names:
typedef void (*addMSGFunc)(unsigned char *, int, struct linkedList *);
typedef struct linkedList {
int count;
struct msgNode *front;
struct msgNode *back;
addMSGFunc addMSG;
} msgList;
void addMSGImpl(unsigned char *data, int size, struct linkedList *self)
{
...
}
And then after creating a msgList:
msgList myList;
myList.addMSG = addMSGImpl;