I’m a beginner in linked lists so don’t judge me. I have a linked list inside of another linked list. For example I have students associated with tables. I already connected my students node with the table nodes and I already have all the values I needed.
What I’m trying to do is looping through my linked list and basically remove a counter from the variable value for each student. And after that verify if value=0 then I should remove/delete that node.
These are my 2 structs:
Note: (counter is not my only variable in the node_student)
struct node_student{ int counter; node_student * next; } struct node_table{ node_student * students; node_table * next; } node_table * remove_nodes(node_table * head){ node_table * iterator = head; node_student * iterator2 = iterator.students; /* Now I have problems with the looping, here I wanna loop through the iterator2 which are the students and do counter--;/* /* After the above operation I want to loop again through the student node and remove those which counter are 0;/* return /*head/* }