fix function lecture to use pointers