3 ms·
> There may be cases where by-reference (yes, that's an absolutely acceptable thing to say, even in C) I don't want to be nit-picking. But I would like to know
by foo101 8y ago
> There may be cases where by-reference (yes, that's an absolutely acceptable thing to say, even in C)
I don't want to be nit-picking. But I would like to know why "by-reference" is an acceptable thing to say.
When I learnt C, C++, Java, etc. I was repeatedly told that pass by reference exists only in C++. In C, a pointer is passed by value. In Java, a reference is passed by value.
Doesn't calling "pass pointer by value" as "pass by reference" lead to confusion and distortion of the true meaning of "by reference"?
- pubby 8y agoWhat do you do when you want to find the value a pointer points to? You dereference it of course! C++ and Java have their own specific language-lawyer definitions of the word reference, but outside of those languages, "reference" is a catch-all term that includes pointers, handles, and indexes.
- robotresearcher 8y agoC implements the concept 'pass by reference' using the mechanism of 'pointer passed by value'. You have no problem using the terms 'loop' or 'recurse' to describe C code, right? But these high-level ideas are implemented without using those terms in the code. Same with 'pass by reference'.