Sunday, July 12, 2009

What's the difference between pass by reference and pass by value in C++?

Passing by value makes a copy of the data, passing it on the stack to the function. That means changes to the data in the function will not change the original data after the function returns





Passing by reference passes the address of the data, which means changes to that data in the function will persist after the function ends

cosmos

No comments:

Post a Comment