I have the following structs:
struct mtmFlix_t {
List usersList;
List seriesList;
};
struct User_t {
int age;
char* username;
MtmFlix mtmFlix;
};
These are the typedefs in list.h :
typedef void* ListElement;
typedef ListElement(*CopyListElement)(ListElement);
typedef void(*FreeListElement)(ListElement);
These are the typedefs in user.h and MtmFlix.h :
typedef struct User_t *User;
typedef struct mtmFlix_t* MtmFlix;
I would like to use the following function in mtmflixCreate, but I can't seem to figure out how to cast the UserCreate
and UserFree
to (*void)
?
List listCreate(CopyListElement copyElement, FreeListElement freeElement);
MtmFlix mtmFlixCreate()
{
MtmFlix newMtmFlix = malloc(sizeof(*newMtmFlix));
if (newMtmFlix == NULL) {
return NULL;
}
newMtmFlix->seriesList=listCreate(?????);
newMtmFlix->usersList=listCreate(?????);
}
The following functions appear in user.h :
User UserCreate(MtmFlix mtmFlix, const char* username,int age);
Void UserFree(User user);