Guest User

Untitled

a guest
Apr 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. use std::ptr;
  2.  
  3. static mut NUM: *const i32 = ptr::null();
  4.  
  5. fn main() {
  6. {
  7. let b = Box::new(55);
  8. unsafe {NUM = &*b as *const _};
  9. }
  10. let b = Box::new(22);
  11. println!("NUM: {}", unsafe {*NUM});
  12. }
Add Comment
Please, Sign In to add comment