|
|
|
|
|
by bin_bash
1294 days ago
|
|
I don't think any of the languages you mentioned support true pass-by-reference. (maybe C# and Java, but it's not common) I've heard what you're describing as "pass-by-value-reference" Go, however, supports pass-by-reference which allows you to write a function like this: func swap(x *int, y *int) {
var temp int
temp = *x /* save the value at address x */
*x = *y /* put y into x */
*y = temp /* put temp into y */
}
|
|