print word have length n

i have string
i want to print word has lengh is n
ex char *s="hello ! thank you"
n=5 print : 'hello' and 'thank'
well, I thin you could use strtok ( http://www.cplusplus.com/reference/clibrary/cstring/strtok/ ) to get all the words separated and then strlen ( http://www.cplusplus.com/reference/clibrary/cstring/strlen/ ) to see if it's length equals n
Topic archived. No new replies allowed.