Pergunta de entrevista da empresa Spark Energy

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

Respostas da entrevista

Sigiloso

8 de out. de 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

Sigiloso

30 de out. de 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.