I just noticed you referencedI'm the author of the my articleblog post you're talking about. To clarify a few things:
Removed historical information (that is what the revision history is for)—the answer should be as if it was written right now; see e.g. <https://meta.stackexchange.com/a/131011> (near "Changelogs").
Peter Mortensen
- 31.5k
- 22
- 110
- 134
Add more explanation as to why C's swap(&x, &y) isn't an exception to pass-by-value, and can also be simulated in Java.
Scott Stanchfield
- 30.7k
- 9
- 53
- 67
What you described was passing a pointer into a function in C. The function would need to explicitly de-reference that pointer, just as I describe for Java. (The fact that in C you can create a pointer to a var just clouds the issue; it's still not reference semantics)
Scott Stanchfield
- 30.7k
- 9
- 53
- 67
clarify that the pointer can be changed but the change won't be visible outside the method
Scott Stanchfield
- 30.7k
- 9
- 53
- 67
Added a little clarification as to why I say "pointers"/"addresses". Please do not change terms like this in my answer
Scott Stanchfield
- 30.7k
- 9
- 53
- 67
Changed back to "his". You changed it to the improper "it's" instead of the proper possessive "its". My style is to treat the Dog as a "he"; that makes it a little more personable. Your edit fixed nothing and introduced grammatical errors. Please only correct actual problems.
Scott Stanchfield
- 30.7k
- 9
- 53
- 67
Scott Stanchfield
- 30.7k
- 9
- 53
- 67