Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Just for future reference, the devrant category is for rants about devRant itself.
imshravan64202dok I was not aware. sorry
iiii4144202dAnd it's just an unsigned number.
RememberMe15433201d@iiii but numbers lie
Numbers have properties that pointers don't (like addition and every number being same-ish. Pointer accesses can very wildly in access time and bandwidth).
We were taught pointers as abstract arrows that happen to be represented by unsigned numbers in the von Neumann big row of memory abstraction that CPUs follow. I think that explanation is clearer because it decouples what a pointer is from how it's implemented. It's an indirection, just an arrow to something, almost like what a pronoun does in a sentence. Because computers represent everything with numbers, the arrow is also a number. Because von Neumann abstraction needs a linear contiguous memory space, the pointer-numbers occupy a linear contiguous memory space.
Basically, the same reason why explaining recursion via call stacks is bad. Recursion has nothing to do with stacks at all, it's just the ability of something to refer to itself, usually by using its name as an indirection (hint hint abstract pointer) though there are technically other ways of doing it. It's just that ordinary function call on CPUs happens via call stacks so that's the perspective you generally learn. Important because there's no reason why recursion can't have other implementations (conversion to iteration for primitive recursion, unrolling, spatial/parallel hardware or concurrent processes etc.).