I have a short snippet where I am passing a char array into another function and changing the size in memory.
// in main
char *str = argv[1];
find(&str);
void func(char **str){
// some code
*str = realloc(*str, 10+1);
}
This gives the error
realloc(): invalid pointer
Aborted (core dumped)
What did I do wrong here? In order to change the value of str
in another function, I am using a double pointer.