Advertisement
Shanix

Untitled

Mar 17th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. for ( int i = 0; i < linesSize; i++ ) {
  2. token = strtok( backupArray[i], " " );
  3. while ( token != NULL ) {
  4. // Trying to get rid of punctuation
  5. int counter = 0;
  6. char *word = malloc( INPUT_SIZE * sizeof( char ) );
  7. int tokenLen = strlen( token );
  8.  
  9. for ( int l = 0; l < tokenLen; l++ ) {
  10. if ( isalpha(token[l]) ) {
  11. word[counter] = token[l];
  12. counter++;
  13. }
  14. }
  15.  
  16. word[ counter ] = '\0';
  17. wordsInLine[index] = word;
  18. index++;
  19. lineLength++;
  20.  
  21. token = strtok(NULL, " "); // this annoys me to no end.
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement