Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 625 Bytes

File metadata and controls

19 lines (12 loc) · 625 Bytes

Exercise 2.1 - Basics

If you do not finish during the lecture period, please finish it as homework.

Pointers (swap.go)

  • Write a function to swap two integer variables in the caller function
  • Write a function to swap two integer pointers in the caller function (2 ways)
  • Write test example code ExampleSwap inside a swap_test file

Questions

What is the difference between a pointer and a Java object reference? What happens if you assign nil to a pointer variable and dereference the pointer?

After this Exercise

  • You know difference between Pointers and Values
  • You know how to write basic unit tests