title: Change the values within NSArray by dereferencing?
body: <p>I've come across a problem related to pointers within arrays in objective-c. </p>
  
  <p>What I'm trying to do is take the pointers within an NSArray, pass them to a method, and then assign the returned value back to the original pointer(the pointer which belongs to the array).</p>
  
  <p>Based on what I know from C and C++, by dereferencing the pointers within the array, I should be able to change the values they point to... Here is the code I'm using, but it is not working (the value phone points to never changes based on the NSLog output). </p>
  
  <pre><code>NSArray *phoneNumbers = [phoneEmailDict objectForKey:@"phone"];
      for (NSString* phone in phoneNumbers) {
          (*phone) = (*[self removeNonNumbers:phone]);
          NSLog(@"phone:%@", phone);
      }
  </code></pre>
  
  <p>And here is the method signature I am passing the NSString* to:</p>
  
  <pre><code>- (NSString*) removeNonNumbers: (NSString*) string;
  </code></pre>
  
  <p>As you can see, I am iterating through each NSString* within phoneNumbers with the variable phone. I pass the phone to removeNonNumbers:, which returns the modified NSString*. I Then dereference the pointer returned from removeNonNumber and assign the value to phone.</p>
  
  <p>As you can tell, I probably do not understand Objective-C objects that well. I'm pretty sure this would work in C++ or C, but I can't see why it doesn't work here! Thanks in advance for your help!</p>