If you do not finish during the lecture period, please finish it as homework.
- Write a function to swap two integer variables in the caller function (2 ways)
- Write a function to swap two integer pointers in the caller function (2 ways)
- Write test example code "ExampleSwap inside a swap_test file
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?
A Book Index is a inverted index which lists all pages a word occurs in a book. Write a program which generates an inverted index out of an array of book pages. Each Page contains an array of words.
- Define custom types for Book, Page and Index
- Make sure the Stringer() interface is implemented for Book and Index to make them printable
- Write an unit test which generates a book and calculates the index and prints it to Stdout
- You know difference between Pointers and Values
- You know the basic Go container types: string, map, array, slice
- You know how to make custom types printable
- You know how to write basic unit tests