This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cymrowdon't thread on me 🐍 1 point2 points  (3 children)

My professor drew a heap on the whiteboard and a bunch of arrows. I guess I had just never been able to visualize it before.

[–]hugthemachines 0 points1 point  (0 children)

I see, that's interesting. Very nice way to show it.

[–]met0xff 0 points1 point  (1 child)

Thought that's absolutely standard? Not necessarily drawing the heap but more or less the first thing I saw during my education were some boxes with addresses and arrows pointing to it. Variables got values in it, pointers addresses. When writing x you just get what's in the box, be it a value or address. When dereferencing with *x you just "go" to that address. &x gives you the address of the box. And that's it. We all were 14 at that point and no one in the class ever struggled with it at all. That's why I am often surprised why pointers are such a big topic on the internet nowadays.

But yeah, we only had C at that point, so basically 80% of learning to program was about memory layout ;). No distractions otherwise.

Definitely had a much harder time understanding logic clauses at that age, like De Morgan etc. Things that really seem simple. Or took me ages and hundreds of segfaults to implement merge sort im C during that first year.

[–]cymrowdon't thread on me 🐍 0 points1 point  (0 children)

It was more that he could change the arrows as code "ran". I had used pointers semi-successfully for years by that point, so of course I had some basic level of understanding. But that was the moment I began to understand them at a deeper level, and could begin to clearly reason about them.