source-academy / cs1101s

1 stars 0 forks source link

What is the difference between variable passing by value and passing by reference? #18

Open mrqorib opened 4 years ago

mrqorib commented 4 years ago

Question: Under which situation is the value of a variable passed to something? Under which situation is a reference passed? Piazza: https://piazza.com/class/kas136yscf8605?cid=632#

mrqorib commented 4 years ago

Answer: If the variable is bound to a primitive value, it is passed by the value. If the variable is bound to a computational object, it is passed by the reference.