Pls explain this program from lifetime perspective

⚓ Rust    📅 2025-07-19    👤 surdeus    👁️ 4      

surdeus



#![allow(warnings)]
fn main() {
   
   
    let mut q = 44;
    let mut z = 4;
    

    let mut x: &mut u32 = &mut z;
    
 

  
    let mut f: &mut &mut u32 = &mut x;

 
    println!("{}", z);

   
    let mut s: &mut u32 = &mut q;


   x= &mut s;
   println!("{}", x);
   
 
 
    f = &mut s;

    

    println!("{}", f);

}

(Playground)

2 posts - 2 participants

Read full topic

🏷️ rust_feed