Subtopic 3 of 4
7.3Parameter passing
By value: copy; callee cannot change the caller. By reference: address passed. Copy-restore: copy in, copy out at return. By name: textual substitution, argument re-evaluated at every use.
i1
A[1]3
A[3]9
- Copies of 1 and 3 are swapped inside swap
- Nothing is copied back: i = 1, A = [0, 3, 7, 9] (unchanged)
swap(a, b) { t = a; a = b; b = t } called as swap(i, A[i]) with i = 1 and A = [0, 3, 7, 9]
Previous year questions: Runtime Environments (2)
PYQs are grouped by topic, so this is the full set for Runtime Environments; try the ones that match this subtopic. Open all 2 on the topic page.