2 ms·
My guess is, people are trying to keep variables the primary concept, and explain pointers on top of that. Hence, ‘boxes’ again crop up in an explanation of poi
by aasasd 8y ago
My guess is, people are trying to keep variables the primary concept, and explain pointers on top of that. Hence, ‘boxes’ again crop up in an explanation of pointers.
For me, everything became much more clear when I realized that the heap memory stands on its own as a concept, being a big pile of bytes instead of ‘boxes’—and implicit allocation/deallocation of variables is just a thin veil on top (muddying the matter somewhat since vars can themselves be stored in memory and point to it).
Guess I had to deal with OOP before I grokked all the pointer-juggling going on behind the scenes.
- Traubenfuchs 8y agoThat's funny, I made a completely contrarian comment: I believe there is not enough talk about boxes and too much about irrelevant memory magic!
- maxxxxx 8y agoI visualize memory as a big range and variables occupy space on them. The pointer is just the first byte of that space. Once you realize that C is basically placing stuff on memory things become pretty clear I think.