strcspn returns a character position where strpbrk returns a pointer.
Other than that, if no character is found, strpbrk returns a null
pointer; IIRC, under the same circumstances strcspn returns the index
of the NUL at the end of the string (which is rarely useful).
They go back to the days of C when stupid, unrememberable names were common. The reason is there were no namespaces, classes or function overloading to keep things straight.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.