Saturday, 5 December 2015

Linked List - entering data at the end

https://www.youtube.com/watch?v=3m6yitpOaLM

Program in C to enter data at the end of linked list



void end(struct node* head, int data){
struct node* newNode;
struct node* temp; newNode=(struct node*)malloc(sizeof(struct node));
newNode->data=data;

while(head!=NULL){
temp=head;
head=head->next;
}
newNode->next=temp->next;
newNode->prev=temp;
temp->next=newNode;
}

No comments:

Post a Comment