Are you asking how to extract multiple tokens out of the same string? If that's the case, then understand how strtok works and how you're supposed to use it.

strtok works with an internal static buffer. So the first time you call it, you need to pass in the string you want it to tokenize, in which case it will load that string into that internal static buffer. Then to continue working with that same string, you pass in NULL. And to start working with a different string, you pass in that new string instead of NULL.

The return value of strtok is a pointer to the token that was found, or NULL if none was found. So to get the next token, you call strtok again. If I understand what you want, each time you call strtok, you need to save the token that is returned to you. Now, strtok changes the original string that you pass to it and I think that it replaces the delimiter it finds with a null-terminator, but don't quote me on that. The way that we use strtok is to either immediately process the token (eg, convert a number token to an int) or to strcpy the token to a string.

Now, if you instead want to be tokenizing more than one string at the same time, then you can't do that with strtok because of that static internal buffer. However, you may be able to do it with the reentrant version, strtok_r. I'm not familiar with that one, but you can read up on it in the man page.

strtok works "in-place" by replacing delimiters with nul and returning a pointer to the start of terminated substring. If you want the data in strings associated with variables you can either assign each extracted token to a pointer variable (zero-copy) or use strcpy() to move the content do an array variable.