3 ms·
The 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 subs
by duskwuff 2y ago
The 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.