3 ms·
I'd stick with avoiding passing pointers unless you really need to change more than one parameter within the function or unless you have a "large" data structur
by Jach 14y ago
I'd stick with avoiding passing pointers unless you really need to change more than one parameter within the function or unless you have a "large" data structure or unless you're using C++ and passing objects around, then you want to avoid the copy constructor and destructor. (Java passes all objects by pointer-value.) I'd also recommend getting in the "const pointer" habit, because then anyone (or compiler) reading your code can be guaranteed you aren't going to change things passed to your function.