title: Making a pool concept in c++
body: <p>I have a structure as</p>
  
  <pre><code>struct Employee 
  { 
   char   uName  [255]; 
   struct   Employee *  next; 
   struct   Employee *  prev; 
  };
  </code></pre>
  
  <p>All i want to allocate memory of 100 stucture objects at a time and then use them one by one i making a linked list.If the memory is consumed fully then again i want to allocate 100 object memory</p>
  
  <p>I am doing the allocation as</p>
  
  <pre><code>struct Employee * chunk=new struct Employee[100];
  </code></pre>
  
  <p>Now when i want to add a new node to a linked list i want to take objects from this already allocated memory.Can somebody tell how to achieve this</p>
  
  <pre><code>Employee * pEmployeeData=NULL;
  for(long int i=1;i&lt;=100;i++)
  {
          pEmployeeData=EmployeePool+i;
          pEmployeeData-&gt;next=NULL;
          pEmployeeData-&gt;prev=NULL;
          InsertAtEnd(pEmployeeData);
  }
  </code></pre>
  
  <p>where InsertAtEnd inserts the node at the end of the linked list.Please tell how to achieve this</p>