How to use raw pointers

Declare raw pointers as *const T or *mut T and dereference them inside an unsafe block to access memory directly.

Use raw pointers by declaring them as *const T or *mut T inside an unsafe block, then dereference them with *ptr to access the data.

fn main() {
    let mut num = 5;
    let r1 = &num as *const i32;
    let r2 = &mut num as *mut i32;
    unsafe {
        println!("r1: {}, r2: {}", *r1, *r2);
    }
}