title: How do I pass (by value) a struct in Objective-C?
body: <p>This one has been driving me mad!  I have a struct:</p>
  
  <pre><code>typedef struct{
    int a;
  }myStruct;
  </code></pre>
  
  <p>Then I have:</p>
  
  <pre><code>myStruct tempStruct;
  </code></pre>
  
  <p>I am trying to pass the struct to a class method whose implementation is:</p>
  
  <pre><code>- (void) myFunc:(struct myStruct)oneOfMyStructs{};
  </code></pre>
  
  <p>I call the method like so:</p>
  
  <pre><code>[myClass myFunc:(struct myStruct)tempStruct];
  </code></pre>
  
  <p>The compiler complains about "Conversion to non-scalar type requested."  All I want to do is pass a struct into a class method, but the syntax has me a bit confused.  I'm new to Objective-C.  Please let me know if you can see where I'm going wrong.  I've not been able to pass by reference either, so if you could help me out with that, that would be great!</p>
  
  <p>Thanks!</p>