Quiz · Borrowing · lesson 8 of 11
Quiz — returning &String
What happens when this program is built and run?
fn make() -> &String {
let s = String::from("hi");
&s
}
fn main() {
let r = make();
println!("{}", r.len());
}What happens when this program is built and run?
fn make() -> &String {
let s = String::from("hi");
&s
}
fn main() {
let r = make();
println!("{}", r.len());
}