title: Initialized variable before MPI_Init() and cout after MPI_Finanlize()
body: <p>I have been testing how exactly mpi works with the following code</p>
  
  <pre><code>    #include &lt;iostream&gt;
      #include &lt;mpi.h&gt;
      using namespace std;
      int main(int argc, char *argv[]){
      r = 3.0;
      int id; 
      int p;
      int a[100];
      for(int i=0;i&lt;100;++i){a[i]=i+5; }
      MPI_Init(&amp;argc, &amp;argv);
      MPI_Comm_rank(MPI_COMM_WORLD, &amp;id);
      MPI_Comm_size(MPI_COMM_WORLD, &amp;p);
  
      cout&lt;&lt;id&lt;&lt;"   "&lt;&lt;r&lt;&lt;"   "&lt;&lt;a[id]&lt;&lt;endl;
  
      MPI_Finalize();
  
      cout&lt;&lt; "Hello world " &lt;&lt;endl;
  
      return 0;
      }
  </code></pre>
  
  <p>I am using 30 cores to run the code. but the output is somehow surprising on 2 aspects,</p>
  
  <ol>
  <li>Here this <a href="https://stackoverflow.com/questions/20527338/mpi-and-global-variables">question</a> says that if you initialize a variable before MPI_Init(), the other process but 0 will be blind about the initialized value, but in my output file all the process of different ids output the r=3 and the correct value for <code>a[i]</code>, so does this mean that I can initialize a variable or an array before calling MPI_Init() and all processes will share the same value for that variable?</li>
  <li>The output has a lot of lines of "Hello world " which apparently indicates that each process is printing "Hello world " even after calling MPI_Finalize(), why is that?</li>
  </ol>
  
  <p>By the way, I am using mpicc for compiling the code.</p>