title: ObjectiveC Copying object from one NSMutableArray to another "invalid lvalue assignment"
body: <p>I'm trying to make an object in one array equal to another. If I set each property individually, it works fine, but I want to set one object equal to antoher without writing a function to run through each property.</p>
  
  <pre><code>-(void)DrawCard: (int) wp{
  [self GetNc :(wp)];
  if (nc &gt; 0){    
      ((card*) [[Hands objectAtIndex:wp] objectAtIndex:nc]) = ((card*) [[Draws objectAtIndex:wp] objectAtIndex:0])
  }
  </code></pre>
  
  <p>}</p>
  
  <p>(wp stands for which player. All GetNc does it set the integer nc (for new card), by finding the highest index of a card object currently being used in Hands).</p>
  
  <p>That won't compile, but setting an individual property does:</p>
  
  <pre><code>    ((card*) [[Hands objectAtIndex:wp] objectAtIndex:nc]).suit = ((card*) [[Draws objectAtIndex:wp] objectAtIndex:0]).suit;
  </code></pre>
  
  <p>And trying without casting gives invalid l-value error as well ie:</p>
  
  <pre><code>        [[Hands objectAtIndex:wp] objectAtIndex:nc] = [[Draws objectAtIndex:wp] objectAtIndex:0];
  </code></pre>
  
  <p>(Is it ever possible to set an array object without casting?)</p>
  
  <p>I appreciate your time to read and respond. Cheers!</p>