title: Implementing circular lists and how to delete a middle node in a list
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  struct cir{
  
      int info;
      struct cir* next;
  
  };
  
  struct cir* create(int num){
  
      struct cir* temp;
  
      temp=(struct cir*)malloc(sizeof(struct cir));
  
      temp-&gt;info=num;
      temp-&gt;next=NULL;
  
      return(temp);
  }
  
  
  struct cir* insertlast(struct cir** head0, struct cir* new1){
  
      struct cir* temp;
  
      temp=(*head0);
  
      if(temp==NULL){
  
          new1-&gt;next=new1;
  
          return(new1);
      }
  
      else{
  
          while(temp-&gt;next !=(* head0) ){
  
              temp=temp-&gt;next;
  
          temp-&gt;next=new1;
          new1-&gt;next=(*head0) ; }
  
      }
  
      return(*head0);
  
  }
  
  void vizualize(struct cir* head0){
  
      struct cir* temp;
  
      temp=head0;
  
      printf("Lista:");
  
      while(head0-&gt;next != temp ){
  
          printf("[%d]--&gt;", head0-&gt;info);
          head0 =head0 -&gt;next;
  
      }
  
      printf("%d(testa)", head0-&gt;info);
  
  
  
  }
  
  int main(){
  
      struct cir* head;
      int i,n1,n2;
      struct cir* new1;
  
  
      printf("Insert the number of elements you want to put in  the list:\n\n");
      scanf("%d", &amp;n1);
  
      for(i=0;i&lt;n1;i++){
  
          printf("Insert the element you want to insert in the list:\n\n");
          scanf("%d", &amp;n2);
  
          new1=create(n2);
  
          insertlast(&amp;head,new1);
      }
  
      vizualize(head);
  
  }
  </code></pre>
  
  <p>Hi there! I've written this code to implement a CIRCULAR list, but when I try to run the code it crashes.</p>
  
  <p>I've created the function <code>struct cir* create(int num)</code> to create a single element to insert in the circular list list by calling the function <code>struct cir* insertlast(struct cir** head0, struct cir* new1</code> to attack the element to the circular list.</p>
  
  <p>Furthermore, as reguard the bidirectional lists:</p>
  
  <pre><code> if(temp-&gt;next!=NULL){
  
          (temp-&gt;next)-&gt;prev=NULL;
  </code></pre>
  
  <p>what does   </p>
  
  <pre><code>(temp-&gt;next)-&gt;prev=NULL;
  </code></pre>
  
  <p>do?</p>
  
  <p>Last question, is there anyone who can write here a code  to delete an element in the middle of a monodirectional list? 
  I've tried in any way but everytime I try to delete one element the programm crashes or the list is vizualize in the same way!</p>
  
  <p>Thanks a lot!</p>
  
  <p>ps.which is the difference between deleting and extracting an element from  a list?</p>