In order to run and execute programs, you need to store the programs and related variables. Memory units like RAM, ROM and other types are used depending on the requirement. These memory units are divided into sub units with the help of memory addresses. We generally refer to these memory addresses in hexa decimal digits.

Simple memory representation

A simple memory representation is given below. When we create a variable, then specific memory locations are assigned to each variable.

Memory Address

For example, let us assume we want to save a number in memory. In languages like C we have a type called int that allows us two store whole numbers. When we create a variable of type int, a memory of 2 bytes will be allocated internally. We can assume that locations 0000 and 0001 are assigned to the variable. Pointers, which you will encounter more in various programming languages actually refers to the address of the first location of the variable. If we create a pointer for the variable, it refers to address 0000 and not 0001. The total size of the value in the pointer is inferred from the type of the pointer. You will know more about pointers in the dedicated chapters for pointers in various programming languages.