Playing around with structs and a heap array, taken from Nick Parlante's example
inserted comments for better understanding
learned about the typedef which makes the code more readable