Note that there are some explanatory texts on larger screens.

plurals
  1. POinsert a node at end and delete a node at beginning in double linked list
    text
    copied!<p>Double linked list program </p> <pre><code>#include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; struct node { int data; struct node *rnext; struct node*lnext; }*first=NULL,*last=NULL; void display() { struct node*temp; if(first==NULL) { printf("list is empty\n"); return; } temp=first; while(temp!=NULL) { printf("%d \n",temp-&gt;data); temp=temp-&gt;rnext; } } void insertion() { struct node *temp; struct node *nn= (struct node*) malloc(sizeof(struct node)); printf("enter data to be inserted\n"); nn-&gt;rnext=NULL; last-&gt;rnext=nn; nn-&gt;lnext=last; last=nn; } void deletion() { struct node *temp; if(first==NULL||last==NULL) { printf("list is empty\n"); return; } temp=first; first=first-&gt;rnext; first-&gt;lnext=NULL; free(temp); } /* main loop */ int main() { int option; do { printf("enter option 1.insertion\n2.display\n3.deletion\n4.exit\n"); scanf("%d",&amp;option); switch(option) { case 1: insertion(); break; case 2: display(); break; case 3: deletion(); break; } } while(option!=4); } </code></pre> <p>i have wrote a double linked list to insert a node at end and delete a node at beginning in linux using C language. but while executing the program getting the error segmentation fault. i am also posting the output.</p> <pre><code>./out enter option 1.insertion 2.display 3.deletion 4.exit 1 enter data to be inserted 12 Segmentation fault please help me with the solution for segmentation fault </code></pre> <p>this is my code please help me run it and debug it .I am inserting the node at the end and deleting the node at the end </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload