3 ms·
I'm not too familiar with Python, but the semantics of Python described here match every other language that I can think of (including C). Can anyone give me an
by tsuyoshi 14y ago
I'm not too familiar with Python, but the semantics of Python described here match every other language that I can think of (including C). Can anyone give me an example of a language that is actually call-by-reference?
- Jach 14y agoC++ supports call-by-reference (and also call-by-value), here's an example of call-by-reference: #include <iostream> void swap(int &x, int &y) { int temp = x; x = y; y = temp; } int main() { int a = 3; int b = 4; std::cout << a; // 3 std::cout << b; // 4 swap(a, b); std::cout << a; // 4 std::cout << b; // 3 }
- jsnell 14y agoPerl.