title: two dimensional array with undefined second dimension
body: <p>I have a problem that I'm not sure how to solve. I have a C++ function that opens a .wav file, reads the samples into an array of doubles that has as many indexes as the number of samples in the .wav file, and return a pointer to that array. This works perfectly. </p>
  
  <p>What I'm wanting to do is read more than one .wav file and store them in a two dimensional array. Although I know <em>how many</em> arrays there will be, the size of each array will be different, because all .wav files have a different nubmer of samples. I don't know how to properly store this data for multiple files.</p>
  
  <p>Here is the call to wav2sig, the function that opens the .wav and returns a pointer:</p>
  
  <pre><code>double* wav2sig(std::string filepath, int &amp; num_samples)
  </code></pre>
  
  <p>And here is the code that I'm working off, roughly.</p>
  
  <pre><code>std::string paths[3] = {"man1.wav",
                            "man2.wav",
                            "man3.wav"};
  
  double **data = new double[3][];   //this would work in java, but not here
  
  int num_samples[3];
  
  for(int i = 0; i &lt; 3; i++) {
       data[i] = wav2sig(paths[i], num_samples[i]);
       for(int j = 50; j &lt; 100; j++)
            std::cout &lt;&lt; data[i][j] &lt;&lt; " ";
       std::cout &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>I know that the returned pointer has all correct data. I just don't know how to store several of them correctly. Thanks for any help!</p>