0

I have the follwoing convention in pseudocode, from the Introduction to Algorithims textbook:

  1. Parameters are passed to a procedure by value: the called procedure receives its own copy of the parameters, and if it assigns a value to a parameter, the change is not seen by the calling procedure. When objects are passed, the pointer to the data representing the object is copied, but the object’s fields are not. For example, if x is a parameter of a called procedure, the assignment x ← y within the called procedure is not visible to the calling procedure. The assignment f [x] ← 3, however, is visible.

What is a calling procedure and what does it mean to be visible or not to it?

Could someone explain to me what the quote wants to say?

Jake Wright
  • 373
  • 1
  • 8
  • Basically that primitives are passed by value and objects are passed by reference. See https://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value – Rotem Jan 07 '18 at 12:31
  • See [call stack](https://en.wikipedia.org/wiki/Call_stack) wikipage – Basile Starynkevitch Jan 07 '18 at 12:31

1 Answers1

0

Let fn1 be the parent scope of fn2, i.e fn2 is called inside fn1. To answer your first question: What is calling procedure? fn1 = calling procedure To answer the second question: what does it mean to be visible or not to it? Variables in fn1 are not visible to variables in side fn2 fn2 receives its copy of the variables through the parameters passed into fn2