Computer memory address

It is important to visualize the computer memory before we get started with pointers.

Because pointers are used to refer the memory location rather than the value stored in the memory.

In other words, variables are used to manipulate the values stored in memory whereas pointers are used to manipulate the variable addresses(memory location).

Let's visualize the computer memory first.

In computer memory, the basic memory unit is a byte (8 bits).

Each byte will have unique memory address. For the sake of understanding, we will represent memory address using decimal value.

Pictorial Explanation

Computer memory address

In the above diagram, each block is a byte which consists 8 bits.

And the memory memory address are linear and each byte will have a unique address.

To store a character, the computer will allocate 1 byte of memory which is 1 * 8 = 8 bit.

To store an integer or a float, the computer will allocate 4 byte of memory which is 4 * 8 = 32 bit.

To store a double value, the computer will allocate 8 byte of memory which is 8 * 8 = 64 bit.

Next topic we will understand, what will happen in the memory, if we declare a variable and assign a value to it.

Topics You Might Like