December Code

December Code / Try Rust

Try Rust

No account needed. Answer, see why, move on.

1 of 3 today

Smart Pointers & Concurrencyeasy

What does this Rust program print?

use std::rc::Rc;

fn main() {
    let a = Rc::new(5);
    let b = Rc::clone(&a);
    {
        let _c = Rc::clone(&a);
        println!("{}", Rc::strong_count(&a));
    }
    println!("{} {}", Rc::strong_count(&b), *b);
}
Choose one option
choose an option

Nothing here is saved. Create a free account to keep your progress, take an assessment and get your readiness score.