Expt 1
Expt 1
Program:
// to demonstrate Insertion,deletion,display in
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
};
list. */
new_node->data = new_data;
new_node->next = (*head_ref);
(*head_ref) = new_node;
linked list */
return;
prev = temp;
temp = temp->next;
}
if (temp == NULL)
return;
prev->next = temp->next;
node = node->next;
// Driver code
int main()
push(&head, 7);
push(&head, 1);
push(&head, 3);
push(&head, 2);
puts("Created Linked List: ");
printList(head);
deleteNode(&head, 1);
printList(head);
return 0;
Output:
2 3 1 7
2 3 7