What\'s the difference between strtok
and strtok_r
in C
and when are we supposed to use which?
strtok
save static pointer for reuse in the next time, when you give NULL as the first parameter, so you just can't parse 2 strings in parallel.
In the strtok_r
you give also the pointer, as out parameter (pointer to pointer). so there is no static pointer in the function and you can move from one string to another and back...