Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdint.h>
- #include <stdio.h>
- #include <stdlib.h>
- struct linkedlistelement_s {
- char data;
- struct linkedlistelement_s* next;
- };
- typedef struct linkedlistelement_s LinkedListElement_t;
- typedef struct {
- LinkedListElement_t* head;
- LinkedListElement_t* tail;
- } LinkedList_t;
- void deleteElement(LinkedList_t* list, LinkedListElement_t* element) {
- linkedlistelement_s* temp;
- if (element->data==list->head->data){
- temp=list->head;
- list->head=list->head->next;
- free(temp);
- temp=NULL;
- }
- else{
- linkedlistelement_s * x;
- temp=list->head;
- while(element->data==temp->next->data)
- temp=temp->next;
- x=temp->next;
- temp->next=x->next;
- free(x);
- x=NULL;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement