-
Rust연습❤️] Displaying raw pointers코딩Coding/Rust연습 2022. 7. 3. 00:38728x90
결과
// https://riptutorial.com/rust/example/24222/displaying-raw-pointers use std::ptr; // Create some data, a raw pointer pointing to it and a null pointer fn main() { let data: u32 = 42; let raw_ptr = &data as *const u32; let null_ptr = ptr::null() as *const u32; // the {:p} mapping shows pointer values as hexadecimal memory addresses println!("Data address: {:p}", &data); println!("Raw pointer address: {:p}", raw_ptr); println!("Null pointer address: {:p}", null_ptr); }
Displaying raw pointers
cargo run Finished dev [unoptimized + debuginfo] target(s) in 0.02s Running `target/debug/rust_polyglot` Data address: 0x16d7dea6c Raw pointer address: 0x16d7dea6c Null pointer address: 0x0
출처 :
https://riptutorial.com/rust/example/24222/displaying-raw-pointers
반응형'코딩Coding > Rust연습' 카테고리의 다른 글
Rust연습❤️“rust spinning rod animation in text” Code Answer (0) 2022.08.13 Rust연습❤️Processing 0~100%올라가는 프린트 ㅎㅎ (0) 2022.08.13 Rust연습❤️HashMap, Arc, Mutex, thread연습 (0) 2022.08.13 Rust연습❤️] Hello from asm__assembly코드 연습 (0) 2022.07.03 Rust연습❤️내 컴퓨터에 병렬 실행 가능한 코어수 알아보기available_parallelism (0) 2022.06.29 Rust – Fibonacci using Recursion and Iteration (0) 2022.06.26 Rust연습❤️) Collect & Vec 조합 Closure활용 (0) 2022.06.23 Rust연습)그래프 그리기 + 움직이는 별 표현하기(움직이는 gif만들기) (0) 2022.06.15