title: Calling a C function from Objective-C with string array
body: <p>I'm trying to call a simple tutorial C function from Objective-C and I can't figure out how to split up the arguments being passed, which is two strings.</p>
  
  <pre><code>int cFunction(int argc, char **argv)
  {
      int i;
      printf("argc = %d\n", argc);
      for (i = 0; i &lt; argc; i++) {
          printf("argv[%d] = \"%s\"\n", i, argv[i]);
      }
      return 0;
  }
  </code></pre>
  
  <p>I've tried <code>cFunction(3, "string1 string2")</code>, <code>cFunction(3, "string1", "string2")</code>, and <code>cFunction(3, args)</code>, with <code>args</code> being an NSArray composed of <code>[textField1 stringValue]</code> and <code>[textField2 stringValue]</code></p>
  
  <p>I get EXC_BAD_ACCESS when trying to <code>printf argv[i]</code>. I've also tried passing 2 as the value of argc.</p>
  
  <p>How should this be called? Thanks</p>