- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 64字
- 2021-07-02 23:07:19
Passing by reference
A variable passed by a reference looks like this:
fn my_function(a: &i32, b: &i32) -> i32
We take two variables as references, and return a value.
To obtain a value from a reference, the first thing to do is dereference it. This is done with the asterisk (*) operator:
let ref_num = &2; let deref_num = *ref_num; // deref_num = 2
推薦閱讀
- Mastering OpenCV Android Application Programming
- Apache Spark 2.x Machine Learning Cookbook
- 羅克韋爾ControlLogix系統(tǒng)應(yīng)用技術(shù)
- Oracle 12c中文版數(shù)據(jù)庫(kù)管理、應(yīng)用與開發(fā)實(shí)踐教程 (清華電腦學(xué)堂)
- 數(shù)據(jù)結(jié)構(gòu)簡(jiǎn)明教程(第2版)微課版
- Windows Phone 7.5:Building Location-aware Applications
- Java編程的邏輯
- 小型編譯器設(shè)計(jì)實(shí)踐
- 移動(dòng)增值應(yīng)用開發(fā)技術(shù)導(dǎo)論
- Python自然語(yǔ)言理解:自然語(yǔ)言理解系統(tǒng)開發(fā)與應(yīng)用實(shí)戰(zhàn)
- Node.js從入門到精通
- Clojure High Performance Programming(Second Edition)
- 軟件測(cè)試技術(shù)
- Oracle SOA Suite 12c Administrator's Guide
- Android熱門應(yīng)用開發(fā)詳解