Hello everyone,
I'm trying to understand the concept of dynamic memory allocation and reallocation in C, specifically how the realloc function works. Let me illustrate my confusion with an example:
Suppose initially allocate dynamic memory for three variables with values 30, 31, and 32, resulting in memory locations 30, 31, and 32. Now, if I want to add two extra numbers but find that memory locations 33 and 34 are already occupied by other variables, and memory are available from 35 location.

What happens when I use the realloc function? How does it handle the situation where the desired memory locations are already in use?