title: Parsing a String in C, Without Strtok()
body: <p>I need to parse a string in C by removing all non-alphabetic characters from it. To do this I am checking the ascii value of every char and making sure its within the correct bounds. It works just the way I want it to, so that's not the problem. What I am having trouble with, however, is storing the resulting strings after the parse is completed. (I am 3 weeks into C by the way) Also if you notice that I used weird sizes for the arrays, that's because I purposely made them bigger than they needed to be.</p>
  
  <pre><code>char * carry[2]; // This is to simulate argv
  carry[1] = "hello1whats2up1"; // 0 is title so I placed at 1
  
  char array[strlen(carry[1])]; // char array of string length
  strcpy(array, carry[1]); // copied string to char array
  
  char temp[strlen(carry[1]) + 1]; // Reusable char array
  char * finalAnswer[10];
  
  int m = 0, x = 0; // Indexes
  
  if ((sizeof(carry))/8 &gt; 1) { // We were given arguments
  
      printf("Array: %lu\n\n", sizeof(array));
      for (int i = 0; i &lt; sizeof(array); i++)
      {
          if(isalpha(array[i])) { // A-Z &amp; a-z
              //printf("%s\n", temp);
              temp[x] = array[i]; // Placing chars in temp array
              x++;
  
          }
          else {
              printf("String Length: %lu \nString Name: %s \nWord Index: %d \n\n",
                     strlen(temp), temp, m); // Testing Purposes
              strcpy(finalAnswer[m], temp); // Copies temp into the final answer *** Source of Error
  
              for(int w = 0; w &lt; sizeof(temp); w++) { temp[w] = '\0'; } // Clears temp
  
              x = 0;
              m++;
          }
      }
      printf("String Length: %lu \nString Name: %s \nWord Index: %d \n",
             strlen(temp), temp, m); // Testing Purposes
      strcpy(finalAnswer[m], temp);
  
      for(int w = 0; w &lt; sizeof(temp); w++) { temp[w] = '\0'; } // Clears temp
  
      x = 0;
  }
  
  else { printf("No Arguments Given\n"); }
  
  printf("\n");
  </code></pre>
  
  <p>** Edit</p>
  
  <p>The error I keep getting is when I try copying temp to finalAnswer</p>
  
  <p>** Edit 2</p>
  
  <p>I solved the problem I was having with char * finalAnswer[10]</p>
  
  <p>When I was trying to use strcpy on finalAnswer, I never specified the size that was needed to store the particular string. Works fine after I did it.</p>