Split string

Hello how do you split string in C by space?

I have:

char * string;
You can use strtok.
http://www.cplusplus.com/reference/cstring/strtok/
1
2
3
4
for (char* token = strtok(string, " "); token; token = strtok(NULL, " "))
{
	printf("%s\n", token);
}
Thank you.
Topic archived. No new replies allowed.