I have a problem with reallocating an array. I want to save inputs to a string array and realloc it with every new entry. Heres my function:
char** history=0;
int historycounter=0;
void saveHistory(char* input){
history=(char**)realloc(history,sizeof(*history)+sizeof(input)*sizeof(char));
history[historycounter]=(char*)malloc(sizeof(input)*sizeof(char));
strcpy(history[historycounter],input);
historycounter++;
}