C++: Doubly linked list I have written the code for linked list in c++. It has function list_search(int)
which returns the node of the given number. list_insertfront(int) inserts the first element. list_insert(int) inserts the element. list_delete(int) deletes the element after searching its node.

#include &lt;iostream&gt;

class double_list{
  struct Node{
       int data;
       struct Node *next; //next will hold the address and *next will show value at that address
       struct Node *prev; //prev will hold the address and *prev will show value at that address
    } *head;
 public:
    double_list(){
    head=NULL; // all address in head are initialised to NULL
    }
     void list_insert(int);
     void list_insertfront(int);
     struct Node *list_search(int n){
        Node *node =new Node();
        node=head;
        while(node!=NULL){
            if(node-&gt;data==n) return node;
        node=node-&gt;next;}
        std::cout&lt;&lt;"No such elementin the list \n";
   }
    void list_delete(int);
    void display();
};
void double_list::list_insertfront(int n){
Node *node=new Node();
node-&gt;data=n;
node-&gt;next=head;
head=node;
node-&gt;prev=NULL;
}

void double_list::list_insert(int n){
   Node *node =new Node();
   Node *temp =new Node();
   node-&gt;data=n;
   node-&gt;next=NULL;
   temp=head;
   while(temp){
    if(temp-&gt;next==NULL){
        temp-&gt;next=node;
        break;
        }
        temp=temp-&gt;next;
   }
}

void double_list::list_delete(int n){

   Node *node=list_search(n);//to search node of the given number
   Node *temp=new Node();
   temp=head;
   if(temp==node){
    head=temp-&gt;next;
   }
   while(node!=NULL){
      if(temp-&gt;next==node) temp-&gt;next=node-&gt;next;
      temp=temp-&gt;next;
      return;
       }
}

void double_list::display(){
    Node *node=new Node();
    node =head;
   while(node!=NULL){
        std::cout&lt;&lt;node-&gt;data&lt;&lt;" ";
        node=node-&gt;next;
    }
}
int main()
{
    double_list list1;
   list1.list_insertfront(5);
    list1.list_insert(1);
    list1.list_insert(6);
    list1.list_insert(7);
    list1.display();
    list1.list_delete(1);
    std::cout&lt;&lt;"\n";
    list1.display();
    std::cout&lt;&lt;"\n";

    return 0;
}


What should I do to improve this code.
Well, it starts with the name. double_list looks like a list of doubles, not a doubly-linked-list, which would be better named list. Anyway, your code doesn't work as a doubly-linked list, and anyway you have one member too few for that.
But your list isn't a generic list of T, but a specific list of int, so that should be reflected in the name too, leading to list_int. Better to bite the bullet and templatize it.
Use one style for class-names, and use it consistently: Either snake_case like the standard, or UpperCamelCase, but please not a mix.
While you can declare a member and a type at the same time, please desist. It's non-obvious, and mimics the pattern of declaring a tag and a typedef-name at the same time in C and C/C++-combi-headers.
Use C++11 nullptr instead of the obsolete NULL-macro. The latter can result in surprising behavior as it can be a zero constant.
Use consistent indentation. Always indent the same amount, and don't forget to indent / dedent as neccessary.
You can signal an error with the return-value or an exception, depending on whether it is expected. But don't ever try interacting with the user directly from generic library code. It seriously restricts usability.
list_search must return a value on every execution-path. If your compiler didn't complain loudly, you should fix your invocation.
Try to use a for-loop directly instead of simulating it with a while-loop.
I wonder why many of your member-functions drag around the prefix list_ as if they were free C-functions.
list_delete and display leak memory.
You are violating the rule-of-three: Your class manages a resource, except is misses a custom copy-ctor and dtor.
Consider allowing output to a different std::ostream than std::cout. While you are at it, implement the stream-output-operator to conform to the standard stream interface.