How to write a equivalent code in c replacing redim other then realloc