Note: I am not 100% confident with memory allocation and how it works, but I understand it for the most part.
When I see realloc() being used, I often see people using a new pointer to store the address space instead of using the same/old one. I am wondering if that is necessary.
Am I able to do the following?
char *string;
string = malloc(5 * sizeof(char));
...
string = realloc(string, 10 * sizeof(char));
More importantly, is this a safe thing to do?