Arrays in C
Hi,
I'm after an efficient way of putting the results of strtok into an array and return it from a function. I don't want to use linked-lists, stacks, etc, just a plain array.
The way i'm doing it at the moment reallocates two sets of memory on every pass of strtok. The other way i've done it is to declare lot's (max) of memory and then to copy it into a resized array at the end.
Is there a simpler way?
p.s. Is there a function which tells you how many elements strtok will output (like in java)?
|