Question
I am making a program in C. And I need to make the following changes to it: (1) Implement a new compound data type that
I am making a program in C. And I need to make the following changes to it:
(1) Implement a new compound data type that defines a node for a linked list of integers. This list will be used to hold multiple scores for a movie.
(2) Implement a function to insert a new integer value into a linked list of integers. This will also require you to implement a function to allocate and initialize a new integer list node.
(3) Expand the compound data type for 'MovieReview' so that now it contains: movie_title - A string with length 1024 movie_studio - A string with length 1024 year - An int in 1920-2999 BO_total - (the Box Office total) A float value scores_head - Head pointer to a linked list of scores for this movie
(4) Modify newMovieReviewNode(), this time the newly allocated review should get an empty linked list of scores.
I have included the code for newMovieRewievNode() which needs to be updated according to (4)
ReviewNode *newMovieReviewNode() { /* * This function allocates a new, empty ReviewNode, and initializes the * contents of the MovieReview for this node to empty values. * The fields in the MovieReview should be set to: * movie_title="" * movie_studio="" * year = -1 * BO_total = -1 * score = -1 * * The *next pointer for the new node MUST be set to NULL * * The function must return a pointer to the newly allocated and initialized * node. If something goes wrong, the function returns NULL */ ReviewNode *newNode = NULL; newNode = (ReviewNode *)calloc(1, sizeof(ReviewNode)); strcpy(newNode->review.movie_title, ""); strcpy(newNode->review.movie_studio, ""); newNode->review.year = -1; newNode->review.BO_total = -1; newNode->review.score = -1; newNode->next = NULL; return newNode; // <--- This should change when after you implement your solution }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started