title: (openmp) I get strange string, "r_saving"
body: <p>I practice using OpenMP, and for that purpose, I've made a very simple parallel printing program.</p>
  
  <p>I have a 2d <code>char*</code> array, which I populate with following function:</p>
  
  
  
  <pre class="lang-cpp prettyprint-override"><code>void addItem( char * arr[4][4], int row, int col ) {
      for ( int i=0; i&lt; row; i++ ) {
          for ( int j=0; j&lt; col; j++ ) {
              arr[i][j] = new char [10];
              strcpy( arr[i][j], "input");
  
              char * tmp = new char [5];
              *tmp = ( i + '0' );
              strcat( arr[i][j],tmp );
              delete [] tmp;
          }
      }
  }
  </code></pre>
  
  <p>In my main function, I have the following:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>int threadNum =4;
  omp_set_num_threads(threadNum);
  #pragma omp parallel
  {
      #pragma omp for
      for ( int i=0; i&lt;threadNum; i++ ) {
          cout &lt;&lt; omp_get_thread_num() &lt;&lt; endl;
          #pragma omp critical
          {
              printItem ( input, row, col );
          }
      }
  }
  </code></pre>
  
  <p>What the <code>printItem()</code> function does is printing the elements of the array </p>
  
  <pre class="lang-cpp prettyprint-override"><code>void printItem (char * arr[4][4], int row, int col) {
      for ( int i=0; i&lt;row; i++ ) {
          cout &lt;&lt; " row " &lt;&lt; i &lt;&lt; endl;
          for ( int j=0; j&lt;col; j++ ) {
             cout &lt;&lt; arr[i][j] &lt;&lt; " ";
          }
          cout &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>The output is </p>
  
  <pre class="lang-cpp prettyprint-override"><code>01
  row 0
  input0 input0 input0 input0
  row 1
  input1 input1 input1 input1r_savings
  row 2
  input2 input2 input2 input2
  row 3
  input3 input3 input3 input3
  32
  row 0
  input0 input0 input0 input0
  row 1
  input1 input1 input1 input1r_savings
  row 2
  input2 input2 input2 input2
  row 3
  input3 input3 input3 input3
  
  .......
  </code></pre>
  
  <p>As you can see, in every thread's job, there is "r_savings" which I didn't add anywhere in my function.</p>
  
  <p>Can you tell me where that comes from?
  Am I doing something wrong?</p>