I'm sure you can get creative with the malloc()
functions. Check them out. I say you break it down like this:
1. malloc() out some memory enough to hold a good amount of data.
2. Create a function that walks through the string and counts the number of words found (excluding the colon-delimiters).
3. Then take that and check if you have to allocate more space.
4. If you need more space, do a realloc() and proceed with your tokenizing.