Spark Energy interview question

What is the difference in passing a structure by val and byref?

Interview Answers

Anonymous

8 Oct 2010

nothing. both are passing the structure by a pointer so both methods can modify the elements. doesn't matter that by ref is a pointer to a pointer

Anonymous

30 Oct 2020

Passing by value - called function gets a copy of the parameters. Passing by reference - means called function gets the address location of the parameters. Any changes on the parameter values will be permanent after the function exits.