reid-llvm/examples/array_structs.reid

28 lines
395 B
Plaintext

// Arithmetic, function calls and imports!
struct Test {
field: i32,
second: [u32; 4],
}
fn test() -> Test {
let value = Test {
field: 5,
second: [6, 3, 4, 8],
};
return value;
}
fn main() -> u32 {
let mut value = test();
let beep = [2, 3, 4];
let boop: f32 = 3;
let mut a = &mut value;
*a.second[2] = 5;
return *a.second[2];
}