// Rust uses row major addressing for arrays // It does not use row major for vectors. fn main() { // rust uses row major in arrays let aa = [[1,2,3], [4,5,6],[7,8,9], [10,11,12]]; for i in 0..4 { for j in 0..3 { let raw_pointer_a = &aa[i][j] as *const i32 as u64; println!("{} {}: {}",i,j,raw_pointer_a); } } // now create a fill an vector of vectors let mut aa: Vec> = vec![]; for ii in 0..5 { let mut bb = vec![]; for jj in 0..500 { bb.push(jj); } aa.push(bb); } // show location in memory of each sub vector. // no matter how much is in the sub vector, it is 24 bytes for i in 0..4 { let rpa = &aa[i] as *const Vec as u64; println!("vec of vecs {} {}", i, rpa); } }