First of all, Call by address is a kind of Call by value.
But since it works a lot like call by reference, it was specially named address.
C doesn't support Call by reference.
But it clearly looks like it supports Call by reference.
Let's pin down the exact difference.
// C++ 코드 -> Call by Reference void f(int& y) { y++; } int main(void) { int x = 10; f(x); printf("%d\n", x); return 0; }
// C 코드 -> Call by Value(address) void f(int* y) { (*y)++; } int main(void) { int x = 10; f(&x); printf("%d\n", x); return 0; }
In the Call by reference code above, x is passed as the argument to the function, and
in the Call by value code below, &x, i.e. the address value (Value) of x, is passed as the argument to the function
Literally, we decided to call it Call by reference when the reference is passed to the parameter through the variable x itself,
and the one below passed an address value like 0x9999. Since it passed the value itself, it should be seen as Call by value.