title: Store tree data structure to an array using inorder transversal in C
body: <p>I am trying to write a code to transverse a tree data structure using inorder transversal and store each node onto an array.</p>
  <p>I came up with this code below to achieve it, please correct me if the code is wrong. Even if this is correct, there must be better ways of doing this than using 'static' which makes 'index' stayed in the memory until the program finishes.</p>
  <pre><code>void *inorderTransversal(AVLTreeNode *node, int treeSize)
  {
      static int index = 0;
      AVLTreeNode *nodesArray[treeSize-1]; 
      if (node == NULL)
          return;
  
      inorderTransversal(node-&gt;left, treeSize);
      nodesArray[index] = node;
      index++;
      inorderTransversal(node-&gt;right, treeSize);
  }
  </code></pre>