title: Access C Array within blocks (variable array count) Objective-C
body: <p>Blocks are fine but what about writing C arrays?</p>
  
  <p>Given this simplified situation:</p>
  
  <pre><code>CGPoint points[10];
  [myArray forEachElementWithBlock:^(int idx) {
      points[idx] = CGPointMake(10, 20); // error here
      // Cannot refer to declaration with an array type inside block
  }];
  </code></pre>
  
  <p>after searching a while found this possible solution, to put it in a struct:</p>
  
  <pre><code>__block struct {
      CGPoint points[100];
  } pointStruct;
  
  [myArray forEachElementWithBlock:^(int idx) {
      pointStruct.points[idx] = CGPointMake(10, 20);
  }];
  </code></pre>
  
  <p>this would work but there is a little limitation I have to create the c array dynamically:</p>
  
  <pre><code>int count = [str countOccurencesOfString:@";"];
  __block struct {
      CGPoint points[count]; // error here
      // Fields must have a constant size: 'variable length array in structure' extension will never be supported
  } pointStruct;
  </code></pre>
  
  <p>How can I access my <code>CGPoint</code> array within a <code>block</code>?  </p>
  
  <p>OR  </p>
  
  <p>Is it even possible at all or do I have to rewrite the block method to get the full functionality?</p>