What is memory?

Memory is a storage unit that is temporarily used during the execution of programs.

What is stack and heap?

A Stack is a section of memory that is allocated when a program is run. Stack contains local variables and function arguments of the program. Heap is a partition in memory that is reserved when a program is run. There are dynamic variables created for the program in the heap. There are no static variables in the heap as it is in the stack. Compared to the stack, heap is larger and has more freedom inside the operating system.

The basic working of stack can be explained by using push and pop functions. push function simply pushes the value at the top of stack and pop function simply pops out the topmost value off the stack.

What is Endianness?

A processor can access the data in memory in different ways in accordance with the memory structure. This is called endianness and it has 2 methods:

  • Big Endian : matching the byte at the smallest address in the memory with the byte (most significant byte) at the largest address in the register when accessing the memory.
  • Little Endian : matching the byte at the smallest address in the memory with the byte (least significant byte) at the smallest address in the register when accessing the memory.