5 kyu

Strings: implement your own "strtok" function!

Description
Loading description...
Strings
Fundamentals
  • Please sign in or sign up to leave a comment.
  • trashy_incel Avatar

    The first call to "strtok" "tokenizes" the function, i.e. splits it into tokens by placing the null-terminating character where any of the delimiters is found.

    • function is a lapsus, i guess the word is meant to be string ;-)
    • This is not true for the standard strtok. You can change delimiters without losing the previous ones. Example :
      char str[] = "abc+def+ghi*jkl";
      strtok(str, "+");  // returns "abc"
      strtok(NULL, "*"); // returns "def+ghi", the '+' character is not lost
      
  • teteban Avatar

    (C) may I suggest precluding the use of strchr, strspn, strtok_r and so on?

  • uniapi Avatar