Size of raw pointer of array in Rust

Viewed 69
    println!("{}", std::mem::size_of::<*mut i32>());
    println!("{}", std::mem::size_of::<*mut [u8]>());

I thought the print results should be the same, after all, pointers are essentially memory addresses. And the size of memory addresses should be the same.

However, when I run the above code, it turns out the size of i32 pointer is 8 while the size of array pointer is 16. How is that coming? Maybe some inner mechanism of array is affecting the result, could somebody explain this to me? Thanks.

0 Answers
Related