title: Pass boolean value by reference
body: <p>Is is possible in objective c to pass a boolean value by reference? I have a number of boolean properties that I need to manage, so I'd like to encapsulate the toggling of these values into a single function that I can call from each button click event. Here is one example:</p>
  
  <pre><code>@interface MyViewController()
  @property (nonatomic) BOOL *sendEmails;
  @end
  </code></pre>
  
  <p>Then in a <code>UIButton</code> click event, I have this method call:</p>
  
  <pre><code>[self updateEmailPreference:self.sendEmails button:self.noEmailsCheckBox];
  </code></pre>
  
  <p>Which calls this method:</p>
  
  <pre><code>- (void) updateEmailPreference : (BOOL *) b
                          button : (UIButton *) button
  {
      if (*b) {*b = NO;}
      else {*b = YES;}
  
      if (*b) {
          [button setBackgroundImage:[UIImage imageNamed:@"checked_checkbox"] forState:UIControlStateNormal];
      } else {
          [button setBackgroundImage:[UIImage imageNamed:@"unchecked_checkbox"] forState:UIControlStateNormal];
      }
  }
  </code></pre>
  
  <p>But unfortunately, this crashes on the <code>if (*b)...</code> block. Is this possible? Thanks!</p>