Call by reference, value, and name

前端 未结 5 869
陌清茗
陌清茗 2020-12-20 16:46

I\'m trying to understand the conceptual difference between call by reference, value, and name.

So I have the following pseudocode:

foo(a, b, c)
{
           


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 17:46

    Call by Value : normal way... values of actual parameters are copied to formal parameters.

    Call by Reference : instead of the parameters, their addresses are passed and formal parameters are pointing to the actual parameters.

    Call by Name : like macros, the whole function definition replaces the function call and formal parameters are just another name for the actual parameters.

提交回复
热议问题