I'm trying to write a function that doubles the size of an array of strings. The function also initializes all the new elements in the array to 100 char strings. However, the function doesnt work at all. I was wondering if someone could tell me what is wrong with it. Thanks.
Code:
char **doubleStringArray(char **stringArray, int* size){
int i;
stringArray = (char**) realloc(stringArray, 2*(*size));
for (i = (*size); i < 2*(*size); i++){
stringArray[i] = (char*) malloc(100);
}
*size = 2 * (*size);
return stringArray;
}