書名: 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
推薦閱讀
- LabVIEW程序設計基礎與應用
- Linux核心技術從小白到大牛
- Vue.js 3.x從入門到精通(視頻教學版)
- Apache Spark 2 for Beginners
- INSTANT Weka How-to
- 面向STEM的Scratch創新課程
- Symfony2 Essentials
- Advanced Oracle PL/SQL Developer's Guide(Second Edition)
- ASP.NET Core 2 Fundamentals
- MySQL入門很輕松(微課超值版)
- Oracle GoldenGate 12c Implementer's Guide
- Mastering Concurrency Programming with Java 9(Second Edition)
- 單片機原理及應用技術
- SQL Server on Linux
- C/C++代碼調試的藝術(第2版)