When we reallocate memory via realloc(), are the previous contents over-written? I am trying to make a program which reallocates memory each time we enter the data into it.
Please tell me about memory allocation via realloc, is it compiler dependent for example?
Don’t worry about the old contents.
The correct way to use
reallocis to use a specific pointer for the reallocation, test that pointer and, if everything worked out ok, change the old pointer