title: free a char**[] in c
body: <p>I'm declaring <code>char** args[3]</code> in the main, and ,<code>malloc</code> it in a function that figure out the sizes herself. Now I need to free the memory in case of failure and at the end of the program (at the main and in other functions) but I don't know the array sizes.</p>
  <p>if I understand correctly <code>(sizeof(args[0])/sizeof(args[0][0])</code> will work at the main only.</p>
  <p>Is that a bad idea/bad practice to create a global <code>sizes[3]</code> and save the sizes there?</p>
  <p>Is there any other possibility in this situation (I mean without changing the code structure)?</p>
  <p>my free function look like that:</p>
  <pre><code>void freeArr(char** parsedStr, int arrSize)
  {
      int i =0;
      while(i &lt; arrSize)
          free(parsedStr[i++]);
      free(parsedStr);
  }
  </code></pre>