[Solved]How to change pointer, through reference to pointer(or pointer to pointer)?


#1
struct Foo {
    ptr: *mut isize,
}


fn main() {
    let mut foo = Foo { ptr: Box::into_raw(Box::new(0)) as *mut isize
    };
    
    init_ptr(&mut foo.ptr);
   
    unsafe { println!("{}", *foo.ptr); }
    
}


fn init_ptr(mut ptr: &mut *mut isize) {
    *ptr = Box::into_raw(Box::new(8888)) as *mut isize;
}