title: divide array into subarrays in c
body: <pre><code>void update(char array[]){
  int i,j;
      for(i = 0;i&lt;NUM_OF_SUBARRAYS;i++){
      char *subarray = array+(SUBARRAY_SIZE*i);
          for(j = 0;j&lt;SUBARRAY_SIZE;j++){ 
              subarray[j]='d';
          }
      //print_array(subarray);
      }
  }
  </code></pre>
  
  <p><strong>Problem:</strong> divide array into <code>NUM_OF_SUBARRAYS</code> and make them all change the original array with "<code>d</code>"s in a single process program (...then in a multi-process program and compare the results)</p>
  
  <p>So, this is my first attempt to solve this in a single process program. if I do it like this, isn't it really inefficient since every sub-array is longer than enough? </p>
  
  <p>For example,</p>
  
  <pre><code>ARRAY_SIZE=10
  
  NUM_OF_SUBARRAYS=2
  </code></pre>
  
  <p>now, every sub-array has 10 elements but 2 was enough actually. Isn't it a problem considering the desired <code>ARRAY_SIZE</code> is 5M? if it is, what should I do? I am kind of lost here, so I'd appreciate if you could briefly explain this to me.</p>