title: Fill an array in C
body: <p>I have a question on filling an array with values in C. I have a string that I want to split into an array of new strings each 14 'sections' long.</p>
  
  <pre><code>int main(int argc , char *argv[])
  {
  char string[]="50 09 00 00 98 30 e0 b1 0d 01 00 00 00 00 4f 09 00 00 98 30 c6 b1 0d 01 01 01 01 50 09 00 00 98 30 e0 b1 0d 01 00 00 00 00 4f 09 00 00 98 30 c6 b1 0d 01 01 01 01";
  
  char delim[] = " ";
  char *result = NULL;
  char *strArray[1440] = {0};
  int i = 0;
  result = strtok(string, " ");
  
  while (result) 
  {
   strArray[i] = result;
   result = strtok( NULL, delim );
   i++;
  }
  
  // Now I have each 'section' of the original string in strArray[xx]
  
  int z = 1022;
  int c;
  char arr[5000];
  char *finalarr[100] = {0};
  char buff[100];
  int l = 0;
  
  for(c=0;c&lt;z;++c) 
  {
    strcat(arr,strArray[c]);
    if (c % 14 == 13)
    {
       // print the value so far for check, this gives an output of 28 chars 
       puts(arr);
       // copy value of arr to buff
       ret = sprintf(buff,"%s", arr);
       // copy value of buff to instance of finalarr
       finalarr[l] = buff;
       // empty arr
       strcpy(arr," ");
      l++;
    }
  }
  
  // both have the same value (last value of arr)
  printf("finalarr1 = %s\n",finalarr[1]);
  printf("finalarr20 = %s\n",finalarr[20]);
  }
  </code></pre>
  
  <p>Perhaps I'm trying to solve it in a too complex way (I hope). Anyway some directions to help would be highly appreciated.</p>