title: How to deal with the deleted items in a struct
body: <p>I am using struct , as I have been asked to so in my assignment . I have deleted a particular struct item from an array , I want to assign a new element at the deleted location , how to achieve that .</p>
  
  <pre><code>const int IN_USE=5;
  
  struct process
  {
      int processID; // added by user4581301 to make sample compile
  };
  
  struct ReadyQueue
  {
      int size;
      struct process * Active;   // Pointer to another struct
      struct process * readyProcesses[IN_USE]; // Array of pointers
  } ready;
  
  
  int main()
  {
      ready.Active = new struct process; // just one object
      // Allocate one object for each index in the array
      for(int i=0;i&lt;IN_USE;i++)
          ready.readyProcesses[i] = new struct process;
      // after assigning values to all the individual processes  
  
      delete ready.readyProcesses[1]; // delete the second  item
      ready.readyProcesses[1] = 0; 
  
      int readyCount=0;     
  
      while(readyCount&lt;IN_USE)
      {
          if(ready.readyProcesses[readyCount]==0) // trying to check if it is deleted
          {
              ready.readyProcesses[readyCount] = new struct process;
              // when I try to set or print  member variable gives segmentation fault 
              ready.readyProcesses[readyCount]-&gt;processID=103;
           }
           readyCount++;
      }
      return 0;
  }
  </code></pre>
  
  <p>In the above program if I want to assign an element at position 1 again . I get segmentation faults . How to address this issue .</p>