Topics
Code from lecture
Pointers
- Pointer declaration - difference/similarities with declaring basic types
- Accessing variables “indirectly” via pointers
- The address and indirection operators: “&” and “*”
- Pointers and arrays - similarities and dfferences
- Passing arrays to functions - specifically looking at how arrays degnerate to pointers on function calls.
Pointers and structs
- Declaring structs
- Different ways of accessing member variables of a structs
- Pointers to structs, why and when to use them?
- Passing structs to functions by value, by reference and by address
- Pointer pitfalls
C++ References
- Creating aliases with references
- Differences between references and pointers
- Constant pointers and references, when and why to use them
Mechanics of function calls with specific attention to call by reference
- Program layout: text, data, bss, stack and heap
- References as function formal arguments
- More on the run-time stack
Intro to lab05