This worked fine and displayed it too. But when I decided to make it a function and pass the pointers as parameters, it ran the function part, but when it came back to main, it did not do the display part.
I really thought that passing pointers necessarily meant that they were passed by reference
In general, that is correct. However, that is only true for the data pointed to by the pointers: The pointers themselves are copied. That is why if you want to modify the actual pointers, they need to be passed by reference.