title: volatile array c++
body: <p>I have an application that has an array of pointers to <code>MyObject</code> objects:</p>
  
  <pre><code>MyObject **arr;
  arr= new MyObject*[10];
  </code></pre>
  
  <p>The application has two threads, these threads will create and delete <code>new MyObject()</code> to array <code>arr</code>. Therefore <code>arr[n]</code> will be changed all the time, however the <code>MyObject</code>'s themselves do not change.</p>
  
  <p>Should I just declare:</p>
  
  <pre><code>volatile MyObject **arr;
  </code></pre>
  
  <p>Or should I go with:</p>
  
  <pre><code>MyObject ** volatile arr;
  </code></pre>
  
  <p>Thanks in advance</p>