title: How to push onto a dynamic sized Array within a function with Solidity?
body: <p>How can I push a value into an dynamic sized array within a function?</p>
  <p>I have a function which builds an array dynamically to use this as a function argument afterwards:</p>
  <pre><code>function autoMintBatch(...) {
      uint32[] xList;
      uint32[] yList;
  
      // ... y is declared properly ...
  
      yList.push(y);
  
      for (uint256 i = 0; i &lt; idList.length; i++) {
          xList.push(x++);
      }
  
  }
  </code></pre>
  <p>I get the following compilation error:</p>
  <blockquote>
  <p>TypeError: Member &quot;push&quot; is not available in uint32[] memory outside
  of storage.</p>
  </blockquote>
  <p>But when I change the variable declaration to storage like:</p>
  <pre><code>uint32[] storage xList;
  </code></pre>
  <p>another error appears:</p>
  <blockquote>
  <p>TypeError: This variable is of storage pointer type and can be
  accessed without prior assignment, which would lead to undefined
  behaviour.</p>
  </blockquote>
  <p>Is there any way to build an array dynamically within a function?</p>