Singly Linked List /**************************************************************************/ #include<stdio.h> #include<stdlib.h> struct Node { int data; struct Node *next; }*head=NULL,*tail=NULL,*temp=NULL,*trav=NULL,*prev=NULL; void create() { temp=(struct Node*)malloc(sizeof(struct Node)); printf("Enter data:"); scanf("%d",&temp->data); temp->next=NULL; if(head==NULL) { head=temp; tail=temp; } else { tail->next=temp; tail=temp; } } void display() { temp=head; while(temp!=NULL) { printf(" %d---->",temp->data); temp=temp->next; } printf(" NULL"); } void insert_begin() { temp=(struct Node*)malloc(sizeof(struct Node)); printf("Enter data:"); scanf("%d",&temp->data); temp->next=NULL; if(head...
Comments
Post a Comment