Skip to content
Quiz · Structs · lesson 2 of 8

Quiz — fields and update syntax

Question 1 of 2

What happens when this program is built and run?

Rust
struct Point {
    x: i32,
    y: i32,
}

fn main() {
    let p = Point { x: 1, y: 2 };
    p.x = 5;
    println!("{} {}", p.x, p.y);
}