|
|
|
|
|
by MaxBarraclough
1293 days ago
|
|
> If I want to pass a variable into a function, and have its value changed by the function, what do I do? A lousy candidate says "put an ampersand in front of it". A meh candidate says to pass a pointer to the variable. The best candidate will talk about the difference between call-by-value versus call-by-reference. I agree it's good for a candidate to demonstrate a solid understanding of evaluation strategies, but the way you phrased the question, the 'meh' answer seems about right. You asked what do I do? which invites a narrow answer specific to the language. |
|
In fact, I had an instructor in college that would have marked you down if a quiz/test asked this question and you wrote an entire paragraph describing call-by-value versus call-by-reference.
On the final, he said "Each of these questions is answerable in 1-3 sentences. If you're writing 1-3 paragraphs, you're wasting my time and I will subtract points even if your answer is correct."