4 ms·
You can't generalize across all languages that modifying an argument modifies something visible outside the function. It is true in languages that have pass by
by adrianmonk 9y ago
You can't generalize across all languages that modifying an argument modifies something visible outside the function. It is true in languages that have pass by reference (C++ with &, Pascal, others) and it isn't true in languages which have pass by value (C, Java).
And yes, passing a reference or pointer by value enables you to have effects that are visible outside the function, but if you copied the reference or pointer value to a local variable, you still could have effects visible outside the function, so that isn't a question of how arguments should be treated; it's a general question of how functions should behave.