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