So I've been studying C++ for the past couple of days, and I'm now on pointers... So like when you pass by value, technically you are having to use double the resources than when you pass by reference. Could that statement be correct?
Not really, it depends on what you're passing. Passing an int pointer compared to an int wouldn't be faster, and would only be reasonable to do if you actually needed to modify the int as a return value of the function.Quote:
So I've been studying C++ for the past couple of days, and I'm now on pointers... So like when you pass by value, technically you are having to use double the resources than when you pass by reference. Could that statement be correct?
One of the greatest things that's happened to me in the past 3 days is that I now understand what you're talking about lol. :P Thanks, I'll definitely keep this in mind.Quote:
Not really, it depends on what you're passing. Passing an int pointer compared to an int wouldn't be faster, and would only be reasonable to do if you actually needed to modify the int as a return value of the function.
Passing structures/classes as pointers is usually faster though.