hey,
I have a problem with the current code:
Code:
typedef struct movieStruct
{
int id;
char movieTitle[20];
int year;
struct movieStruct* next;
} Movie;
typedef struct movieListStruct
{
Movie* head;
} MovieList;
Movie *insert(Movie *head, Movie *current, Movie *prev, int id, char *movieTitle, int year)
{
Movie *new;
new = (Movie *)malloc(sizeof(Movie)))
current = head;
prev = NULL;
new->id = id;
strcpy(new->movieTitle, movieTitle);
new->year = year;
new->next = current;
if (prev == NULL)
{
head = new;
}
return head;
}
Firstly, I want to have the data in the Movie struct be part of the MovieList node but cannot get it working in the insert function, as the data is directly using the Movie struct. Can someone tell me how to change the insert type to MovieList while still actually inserting data into the Movie struct which is part of a MovieList node?