Merge pull request #434 from ZzqiZQute/patch-1

fix: typo
pull/435/head
孙飞Sunface 3 years ago committed by GitHub
commit 99703517f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,7 +43,7 @@ fn main() {
let mut values: [i32; 2] = [1, 2];
let p1: *mut i32 = values.as_mut_ptr();
let first_address = p1 as usize; // 将p1内存地址转换为一个整数
let second_address = first_address + 4; // 4 == std:mem::size_of::<i32>()i32类型占用4个字节因此将内存地址 + 4
let second_address = first_address + 4; // 4 == std::mem::size_of::<i32>()i32类型占用4个字节因此将内存地址 + 4
let p2 = second_address as *mut i32; // 访问该地址指向的下一个整数p2
unsafe {
*p2 += 1;

Loading…
Cancel
Save