title: Placing floats from string into void array
body: <p>I get a segmentation fault when my function reads floats from a string and places them in a void array. The segfault occurs after about 200 iterations of the for loop in the following code:</p>
  
  <pre><code>// Allocate memory
  void** data;
  data = (void**)malloc(num_vals * sizeof(float));
  
  // Convert text to floats
  (*(float**)data)[0] = atof(strtok(text, " "));  
  for(int index=1; index&lt;num_vals; index++) {
      (*(float**)data)[index] = atof(strtok(NULL, " "));   
      std::cout &lt;&lt; (*(float**)data)[index] &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>The void array is necessary because the size and type of data in the string are determined at run-time. I've tried increasing the malloc size, but it doesn't change anything. Any thoughts?</p>