Advertisement
cwchen

[Rust] Pointer to interger

Aug 27th, 2017
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.16 KB | None | 0 0
  1. fn main() {
  2.     let n = 5;
  3.  
  4.     // Get the reference of n
  5.     let n_ref = &n;  // & i32
  6.  
  7.     // Dereference n_ref to get n
  8.     println!("{}", *n_ref);
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement