- #1
- 35,005
- 21,683
Moderator's note: thread split off from https://www.physicsforums.com/threa...cept-its-parameter-by-reference-in-c.1049624/
So long as we are niggling, C/C++ is always call by value. When you call "by reference" you are actually calling with the value of that reference. But f(x) will not change x, and f(&x) will not change &x - but can change x.
That is true, but I am continually surprised and impressed about how much C++ is in C if you just know where to look, "struct" has almost as much power as "class".Mark44 said:Minor point, but copy constructors aren't relevant to C. They are relevant in C++, so I've edited your thread title.
So long as we are niggling, C/C++ is always call by value. When you call "by reference" you are actually calling with the value of that reference. But f(x) will not change x, and f(&x) will not change &x - but can change x.
Last edited by a moderator: