title: Array Pointer not returning from C++ function
body: <p>I have the following code to initialize an array, which works: </p>
  
  <pre><code>int main() {
      int particle_count = 10000;
  
      MyRNG my_rng = MyRNG(0.0,1.0);
  
      Particle simulation_particles[particle_count];
      for (int i = 0; i &lt; particle_count; i++)
      {
          for (int j = 0; j &lt; 3; j++)
          {
              simulation_particles[i].assign(j,my_rng.next());
          }
      }
  </code></pre>
  
  <p>However, when I try to put the for loops in functions, all particles get set to the same values:</p>
  
  <pre><code>void initialize_particle(Particle * p,MyRNG rgen)
  {
      for (int i = 0; i &lt; 3; i++)
      {
          float value = rgen.next();
          p-&gt;assign(i,value);
      }
  }
  void initialize_simulation_particles(int size,Particle * simulation_particles,MyRNG rgen)
  {
      for (int i = 0; i &lt; size; i++)
      {
          initialize_particle(&amp;simulation_particles[i],rgen);
      }
  }
  
  
  int main() {
      int particle_count = 10000;
  
      MyRNG my_rng = MyRNG(0.0,1.0);
  
      Particle simulation_particles[particle_count];
      initialize_simulation_particles(particle_count,simulation_particles,my_rng);
  </code></pre>