toks[i] only gives me the first element. I need to get the whole array. Can I store a pointer to toks in array[i]? I will have multiple iterations through array and toks will be different each time.
I have an array (string array[10]). On every iteration of the program (I have a while loop that calls arrayPush()) toks has different values. I find the next available element in array[] and push toks into array[i].
Later, I want to loop through the array and get toks (with all elements) on every iteration (array[i]).
in other words, toks looks something like this: **toks = {one,two,three}. If I do toks[i] it will only grab one element.
I hope this is a better explanation of the problem.
There are multiple problems with that. Firstly, in your original post, "array" is a pointer to string, which cannot point to a tok. Secondly, the array you would point to would need to remain valid the whole time you were working with it, which in your case may not be possible without dynamic memory (which will get messy very quickly).
Have you considered using std::vector? I highly recommend it - it manages lists of things for you and can dynamically resize by itself. In this case, "toks" would be std::vector<std::string>, and "array" would be std::vector<std::vector<std::string> >