Skip to content
Quiz · Borrowing · lesson 2 of 11

Quiz — borrowing keeps the owner

What does the program print?

Rust
fn len(s: &String) -> usize {
    s.len()
}

fn main() {
    let s = String::from("hello");
    let n = len(&s);
    println!("{s} {n}");
}