Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is the question: Create a linked list structure Music that contains the dat

ID: 3628104 • Letter: T

Question

This is the question:
Create a linked list structure Music that contains the data fields Name, Artist, Number_of_Songs, and a pointer to the list. Create the structure with 3 members and fill in data for each member. Create a function that will display() all the data for each member and call it from the main program.

The solution on your site doesn't work it gets an error from the "curr->next = head;" line says that you can't convert an item to a list and vice versa. How do I fix that?

Explanation / Answer

#include #include #include struct Music { char artist[30]; int no_of_songs; struct list *next; }; typedef struct Music item; int main() { item * curr, * head; int i; char arti[30]; int k; head = NULL; for(i=1;iartist,arti); printf(" Enter no of Songs "); scanf("%d",&k); curr->no_of_songs = k; curr->next = head; head = curr; } curr = head; while(curr) { printf("Artist Name: %s No of songs :%d ",curr->artist,curr->no_of_songs); curr = curr->next ; } return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote