title: How can I define a C array of unspecified size, as an instance variable in Objective-C
body: <p>In Objective-C, how can I define a C array of 'unknown size' as an instance variable, and later populate the array?</p>
  
  <p><em>(Background)</em> : I have a class in Objective-C which handles loading game data. The data is stored in an array of C structs, contained in an external datafile.  I can load in the array and access it, but I need it to be accessible throughout the class.  What I'm trying to do is declare an 'empty' array in my instance variables and then (when loaded) point this empty array or replace it with the one I've loaded in.</p>
  
  <p>This is how I'm loading in my data...</p>
  
  <pre><code>FILE *fptr = NULL;
  fptr = fopen([path cStringUsingEncoding:NSUTF8StringEncoding], "r");
  
  // Create an empty array of structs for the input file with known size
  frame2d newAnimationData[28];
  
  // Read in array of structs
  fread(&amp;newAnimationData, sizeof(newAnimationData), 1, fptr);
  fclose(fptr);
  </code></pre>
  
  <p>So this code works fine to recreate my array of <em>frame2d</em> structs - I just need to know how I can use this as an instance variable.</p>
  
  <p>Any help is appreciated,
  thanks.</p>