title: Simulate 2D array to 1D
body: <p>I have a jagged 2D array, the rows aren't all the same length:</p>
  
  <pre><code>int sizes[100];
  //init sizes
  
  unsigned char *p = [100];
  
  for(unsigned int i = 0; i &lt; 10; i++)
  {
      p[i] = (unsigned char*)malloc(sizeof(char)*sizes[i]);
      for(unsigned int j = 0; j &lt; sizes[i]; j++)
          p[i] = j;
  }
  </code></pre>
  
  <p>I use the array like this:</p>
  
  <pre><code>p[x][y]
  </code></pre>
  
  <p>How can I simulate this array to 1D?</p>