Last active: 2 years ago
use ::anyhow::Result;
fn main() -> Result<()> {
let mut arr = [1, 2, 3];
println!("{:?}", arr);
let p1 = arr.as_mut_ptr();
let p1_size = p1 as usize;
let p2 = (p1_size + 4) as *mut i32;
println!("{:?}", p2);
unsafe {
*p2 += 40;
}
println!("{:?}", arr);
Ok(())
}