I have an object (i.e. an image) that takes up 1MB of memory.
I pass this image into a function, which modifies it.
If I pass this image into the function by reference, would the entire 1MB be copied, or just its place in memory?
I have an object (i.e. an image) that takes up 1MB of memory. I
Share
Passing by reference creates an alias to the object. The only memory used is the stack space allocated to hold the alias.