官术网_书友最值得收藏!

What about functions with arguments?

Consider the following piece of code:

    fn main() 
    { 
        let a = 32; 
        let b = &a; 
    } 

We have created two variable bindings, with the second one (b) pointing at the address for a. The b variable doesn't contain the value of the a variable, but it points to the position a is held at, from which it can obtain a value (in other words, the value of b is borrowed from a).

In terms of our stack diagram, we have this:

The i binding points to address 0 and the b variable points to address 0, and this is the parameter being passed to second.

We can use this stack method to think about memory for a complex situation if you like.

主站蜘蛛池模板: 洱源县| 子长县| 贵定县| 岢岚县| 泰安市| 客服| 博兴县| 怀柔区| 偏关县| 屏边| 铜陵市| 鄯善县| 房山区| 康定县| 淄博市| 宁武县| 顺昌县| 尉氏县| 砀山县| 砚山县| 寿宁县| 德钦县| 伊金霍洛旗| 西城区| 屯留县| 和田县| 东乡| 永康市| 威信县| 辽阳县| 高唐县| 北宁市| 吉安县| 金堂县| 孟津县| 江山市| 报价| 同江市| 宁安市| 晋中市| 沾化县|