edlang/programs/struct.ed

21 lines
284 B
Rust
Raw Normal View History

2024-02-18 09:40:19 +00:00
mod Main {
struct Hello {
a: i32,
b: i64,
}
pub fn main() -> i64 {
let x: Hello = Hello {
a: 2,
b: 3,
};
hello(&mut x);
return x.b;
}
pub fn hello(a: &mut Hello) {
a.b = 5;
}
}