Last active
May 11, 2022 12:32
-
-
Save khirotaka/5e7e947a3dd49b25b5aa31e980b06fe0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::mem; | |
fn main() { | |
let mut a: Vec<i32> = vec![1, 2, 3]; | |
let mut b: Vec<i32> = vec![4, 5, 5]; | |
println!("i32 size of {}", mem::size_of::<i32>()); | |
println!("var a: {:?}", a.as_ptr()); | |
for i in 0..a.len() { | |
println!("\tvar a[{}]: {:?}", i, &a[i] as *const i32); | |
} | |
println!("var b: {:?}", b.as_ptr()); | |
for i in 0..b.len() { | |
println!("\tvar b[{}]: {:?}", i, &b[i] as *const i32); | |
} | |
a.append(&mut b); | |
for i in 0..a.len() { | |
println!("var a[{}] = {} - {:?}", i, &a[i], &a[i] as *const i32); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
実行結果