title: pthreads shared memory between threads
body: <p>So I have a little piece of code that in theory could be parrelized easily.</p>
  
  <p>The structure is very simple, quite similiar to the following:</p>
  
  <pre><code>for (int i = 0; i &lt; some_value; ++i) {
      // we have a function called do_stuff
      // somewhere in the code
  
      // Create a new pthread
      // using do_stuff as start routine
  }
  </code></pre>
  
  <p>Now all the variables are not shared between the threads. That is, no inter-communication of variables between the threads is necessary. However I do use the variable <code>i</code> to write data to arrays and such.</p>
  
  <p>What I'm wondering is: if I pass the variable <code>i</code> as argument for the pthread start routine and the value of <code>i</code> changes (because <code>i</code> gets incremented when in the next loop iteration), does the value of <code>i</code> in the already existing threads also change?</p>