title: dynamically changing the size of string array keeping contents same
body: <pre><code>string *level_two; 
  </code></pre>
  
  <p>I got this array declared in the class. I allocated its size dynamically in a class function.</p>
  
  <pre><code>level_two = new string [size];
  </code></pre>
  
  <p>I need to change its size mainly increase the size retaining the contents, like if size was 5 and my array is declared dynamically as size of 5 and has some string at location 2 and location 3 I want to increase the size of it to 10 depending upon change in size where the strings at location 2 and 3 should be there too without change.</p>
  
  <p>How can I achieve that?</p>
  
  <p>PART II:</p>
  
  <pre><code>int temp=0;
                  temp= final_hash_index_one; 
  
                  final_hash_index_one = sum % number_of_keys_to_be_hashed;
                  sum = 0;
                  cout&lt;&lt;"final_hash_index_one: "&lt;&lt;final_hash_index_one&lt;&lt;endl;
                  if(final_hash_index_one&gt;temp)
                  {
                      string *tmp = new string[final_hash_index_one+1];
                      std::copy(level_two, tmp, final_hash_index_one+1);
                      delete [] level_two;
                      level_two = tmp;
                  }
                  if(temp&gt;final_hash_index_one)
                  {
                      string *tmp = new string[temp+1];
                      std::copy(level_two, tmp, final_hash_index_one+1);
                      delete [] level_two;
                      level_two = tmp;
                  }
  
  
                  level_two = new string [final_hash_index_one+1];
                  level_two[final_hash_index_one] = file_se_uthao;
                  tab_obj[return_structure_index].z = level_two;    
  </code></pre>