+ 3
why call by reference and call by address is preferred by call by value??.
2 Respuestas
+ 1
If I am understanding you question correctly the reason is because passing by value copies the data, and when you are passing objects it uses way more resources(memory, time to process, etc) to copy every object, especially for large or numerous items. for small programs it probably doesn't matter that much.
also passing variables by reference into a function allows for you to "return" multiple values(1 for each value passed in if necessary) because it actually changes the variable in the function. If you are passing by value you can only return 1 variable.
+ 1
Thank u so much