Hey guys,

I'm trying to convert a big chunk of Java code into C, and ran into a little problem with a part of it (been a while since I touched C).

I'm trying to tokenize a string, for example ''a b c d e", using strtok(line, " "); , however I need to put each of the tokens into a different array( result should be [a,b,c,d,e] ). However I don't know how to determine the amount of tokens I will have per line, so I cannot initialize a correctly sized array.

Is there a simple way to figure out how many tokens I'm looking at? (I'd prefer not to use dynamic arrays, seems like an overkill...and of course I can pass through every line twice, noting the amount of tokens each time, but that's horribly ugly and inefficient).

Thanks for any input!
~Ota