title: Assigning struct array to pointer
body: <p>I have initialised an array of structs (containing just a char string called <code>name</code>. This struct array is then assigned to a pointer, like so:</p>
  
  <pre><code>location locations[2] = {{"Padstow", 50.5384, -4.9378}, 
                           {"Newquay", 50.412, -5.0757}};
  
  int location_size = 2;
  
  location *loc_ptr;
  loc_ptr = &amp;locations[0];
  
  // pick an element to remove
  location element = loc_ptr[1];
  
  remove_element(loc_ptr, location_size, element);
  </code></pre>
  
  <p>I am then passing this pointer into a function. Inside this function, I am removing an element of the array. This is done by iterating through the current array, and creating a new array. The new array contains the data I expect.</p>
  
  <p>Inside the <code>remove_element</code> function:</p>
  
  <pre><code>void remove_element(location *ptr, int count, location element) {
  
      // create the new array
      location new_locations[count-1];
  
      // go through and pick out the non-matching element
  
      // create the new pointer        
      location *new_ptr;
      new_ptr = &amp;new_locations[0];
  
      // assign the new array to the original pointer
      ptr = new_ptr;
  }    
  </code></pre>
  
  <p>However, it is not changing the original data. Could you explain what I am doing incorrectly to assign this new array to my original pointer?</p>