Computer memory, pointers, and indirection
All data stored on a computer, however complicated, is at the most basic level a (perhaps not contiguous) sequence of bits (grouped together into bytes). How we interpret these bits is the task of the programmer and, perhaps more so, the compiler. Basic types such as integers and floating-point numbers form the basic building blocks. If this were all we had, we could achieve some things, but our programs would be greatly limited. Addresses, or pointers, allow us to reference other sequences of memory, thus adding one additional layer of indirection and adding room for dynamic representations. This is extremely powerful: it allows a compact block of memory to hold the representation of a much larger piece of data.
Memory itself is divided into two main parts: the stack and the heap (or free store). The stack is a block of memory that is used to store local variables and temporary values, and is managed by the operating system. The programmer...