In some languages such as Pascal, Ada and C++, you can specify that some parameters can be changed inside the subroutine and those changes will "stick" when control returns to the caller. Others, like C and Java, do not permit parameters to be changeable. For example, the following program is legal C but does not do what you expect: void increment (int x) { // This is legal C x = x + 1; // similar to the x++ operation } int main() { int z = 5; increment(z); printf ("%d", z); // shows 5, not 6 } |