Learn C.
Learn how to use pointers, malloc(), and realloc().

Then you'll be set, for life.