struct Node {
char data;
Node* next;
};
Node* list;
And that the following linked list has been created:
for (Node* p = list; p != NULL; p = p->next) if (p->data == 'C') if (p->next != NULL) p->next = p->next->next;

// b. Change List 2
for (Node* p = list; p != NULL; p = p->next) if (p->next != NULL) p->next = p->next->next;

// c. Change List 3
for (Node* p = list; p != NULL; p = p->next) if (p->data == 'A' || p->data == 'E') p->data = '*';

Problem 2: Write a code segment that will change the data field of every node but the last one in list
for (Node* p = list; p != NULL; p = p->next) if (p->next) p->data = 'Z';
Last Updated: April 6, 1997 9:06 pm by