Given the followings :
char delimiters1[] = {' ' , '&' , '<' , '>'};
char delimiters2[] = " &<>";
If I use the C function strpbrk with delimiters1 and delimiters2 , the results would be the same ?
I’ve tested both of them with something like 20 inputs , and I got the same output for both .
Am I wrong ?
thanks .
should be:
It may work few times. But sting should be null-terminated. Otherwise, how will strpbrk will know the end of chars to be searched?
This is the snippet of strbrk():
Where c is the pointer to the char-set. As you can clearly see that at some point
*cshould be null for the program to work correctly.