Concept Flow - realloc function
Start with pointer p
Call realloc(p, new_size)
Check if realloc returned NULL?
Yes→Handle error, keep old p
No
p now points to resized memory
Use resized memory
Free memory when done
The realloc function tries to resize a memory block pointed by p. If successful, it returns a new pointer; if it fails, it returns NULL and the old pointer remains valid.