title: Objective-c EXC_BAD_ACCESS (code=2, address=0x42)
body: <p>I'm new in Objective-C programmation and I receive this error when I run my little program (I just want to generate a random char). So here's what I've done so far:</p>
  
  <pre><code>(IBAction)generate{
    int a = arc4random() % 26;
    NSString * chaine = @"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    char lettre = [chaine characterAtIndex:a];
  
    NSMutableString * mot = [[NSMutableString alloc] initWithCharacters:lettre length:1];
    hasard.text = mot;
  }
  </code></pre>
  
  <p>I tried to simply put my variable 'lettre' in hasard.text but it won't work with the error 'Incompatible integer to pointer conversion assigning to '<code>NSString *</code>' from '<code>char</code>'. So I created an <code>NSMutableString</code> to contain my character. </p>
  
  <p>When I put the character "e" manually instead of the variable 'letter' on the fifth line it works well. Since I can see in the debugger that 'lettre' contains a random letter, why do I get the error in the title ? </p>
  
  <p><code>(EXC_BAD_ACCESS (code=2, address=0x42))</code>. </p>