#include #include struct node{ char value; struct node *next; }; typedef struct node Node; int main(void) { Node *tmp, *tmp2, *start, *end; tmp = tmp2 = start = end = NULL; char input; int i; while (input != -1) { printf("Enter a value(-1 to finalize): "); scanf ("%hhd",&input); if(start == NULL) { start = end = (Node*)malloc(sizeof(Node)); start->value = input; start->next = NULL; } else { end->next = (Node*)malloc(sizeof(Node)); end = end->next; end->value = input; end->next = NULL; } } printf("Enter value of new node: "); scanf ("%hhd",&input); tmp = (Node*)malloc(sizeof(Node)); tmp->value = input; tmp->next = NULL; printf("Enter node value to insert before: "); scanf ("%hhd",&input); tmp2 = start; while(tmp2->next->value != input) { tmp2 = tmp2->next; } tmp->next = tmp2->next; tmp2->next = tmp; //display the list return(0); }