打印变量地址
fn main() { let x: i32 = 5; let addr = &x as *const i32 as usize; { println!("addr: 0x{:X} x: {}", addr, x); let pa = addr as *mut i32; unsafe{*pa = 100}; println!("addr: 0x{:X} x: {}", addr, x); let x: i32 = x + 1; let addr = &x as *const i32 as usize; println!("addr: 0x{:X} x: {}", addr, x); } println!("addr: 0x{:X} x: {}", addr, x); }