I know that the question “when pointer and when reference” or “pass an argument in function by reference or pass by pointer” has been asked numerous times. However, I have the impression that in a few occasions I have read: “You should pass an Object to a function by pointer when you want to modify it”. Could someone say, explain and justify if the last sentence is entirely correct?
Or in other words, isn’t it possible to modify an object through a reference?
You should pass an object as a double pointer if you want to change what the pointer points to, for example when moving the object from one memory location to another:
With a reference you can’t do that.