3 ms·
Doesn't that modify the input in exactly the same way strtok does?
by kstrauser 2y ago
Doesn't that modify the input in exactly the same way strtok does?
- duskwuff 2y agoThe worst problem with strtok() isn't that it modifies its input; it's that it's stateful. It retains a pointer to the input string internally, and returns subsequent words from it when called with an input of NULL. strsep() fixes this by using a char * argument instead.
- duskwuff 2y ago... and HN's formatting mangled that, yay. I meant a char ** argument.