2
有誰知道如何在Rust中創建可變的二維向量並將它們傳遞給被操縱的函數?謝謝。Rust中的二維向量
這是我試過到目前爲止
extern crate std;
fn promeni(rec: &[u8])
{
rec[0][1]=0x01u8;
}
fn main()
{
let mut rec=~[[0x00u8,0x00u8],
[0x00u8,0x00u8]
];
io::println(u8::str(rec[0][1]));
promeni(rec);
io::println(u8::str(rec[0][1]));
}
我可能會讓它們有不同的長度。在那種情況下我會用什麼?如果我的數組不是方形的,我會用什麼?例如,如果我有4行和3列。謝謝。 –