Chapter 1 – Programming language: C++ – Part 3

Pointers and references

On a computer, the memory is organized into bytes. When we assign a value to a data type, we write that value at a memory location.

Pointers are used to store the address location of another variable located in memory (a pointer references a location in memory).

References

A reference variable is a reference to an existing variable.

Pointers

Pointers are used to store the address location of another variable located in memory (a pointer references a location in memory).

Functions

A function is a block of code which only runs when it is called, and they are an important piece of code reuse.

Function callstack

The callstack is a stack data structure that stores information about the active subroutines of a computer program.

The callstack keeps the functions that are called, one on top of the after. If we place a breakpoint (from the IDE) in the doSum function, we have the following function stack: main -> sum -> doSum

You may also like...