I'm reading this book for the second time: "C++ primer plus" and one thing caught my eye: https://i.stack.imgur.com/xZYUW.jpg
Often memory is represented like a linear block(1), say you allocate 2 new blocks of memory,"a" and "b" in (2) and then delete "a" in (3). The arrow is the pointer to free memory according to the book/tutorials. Now these are my questions:
- Do you have 2 pointers to the free memory or just one?
- If you can only have one pointer, and the pointer points to block "a" (which is free again), what if you want to allocate more memory then you have available in "a"?
EDIT: I'm trying to understand how memory allocation really works behind the scenes, so I would like to know into more detail what happens when I type: "int i=0;" or "while(running)".