title: Best practices of dynamic vs. static memory in terms of cleanliness and speed
body: <p>I have an array, called x, whose size is 6*sizeof(float). I'm aware that declaring:</p>
  
  <pre><code>float x[6];
  </code></pre>
  
  <p>would allocate 6*sizeof(float) for x in the stack memory. However, if I do the following:</p>
  
  <pre><code>float *x;   // in class definition
  
  x = new float[6];   // in class constructor
  
  delete [] x;    // in class destructor
  </code></pre>
  
  <p>I would be allocating dynamic memory of 6*sizeof(float) to x. If the size of x does not change for the lifetime of the class, in terms of best practices for cleanliness and speed (I do vaguely recall, if not correctly, that stack memory operations are faster than dynamic memory operations), should I make sure that x is statically rather than dynamically allocated memory? Thanks in advance.</p>