title: copy character from string to another string in C
body: <p>I have a string AAbbCC what I need is to copy the first two and add them to an array then copy the middle two and add them to an array and finally the last two and add them to an array.</p>
  
  <p>this is what I do:</p>
  
  <pre><code>char color1[2];
  char color2[2];
  char color3[2];
  
  strncpy(color1, string, 2); // I take the first two characters and put them into color1
  
  // now I truncate the string to remove those AA values:
  
  string = strtok(string, &amp;color1[1]);
  
  // and when using the same code again the result in color2 is bbAA:
  
  strncpy(color2, string, 2); 
  </code></pre>
  
  <p>it passes those bb but also AA from previous one .. even though the array has only two places, when I use strtol on that it gives me some big value and not 187 which I'm looking for .. how to get rid of that ? or how to make it work other way? Any advice would be appreciated.</p>