It should be this:
myTerms[c] = allTerms[i];
Also, make sure you initialise myTerms
, or you may have dramas when you run realloc
:
char **myTerms = NULL;
In C, you shouldn't cast the result from realloc
either:
myTerms = realloc(myTerms, (c+1)*sizeof(char *));