Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Rust Fundamentals

Lesson 46 of 50 · rust

Smart Pointers (Box, Rc, Arc)

Duration: 12 minutes

Smart Pointers (Box, Rc, Arc)\n\n- Box<T> allocates data on the heap.\n- Rc<T> provides single‑threaded reference counting.\n- Arc<T> provides atomic reference counting for multi‑threaded scenarios.\n\nrust\nuse std::rc::Rc;\nuse std::sync::Arc;\n\nfn main() {\n let b = Box::new(5);\n let rc = Rc::new(10);\n let arc = Arc::new(15);\n println!(\"Box: {}, Rc: {}, Arc: {}\", b, rc, arc);\n}\n\n

Previous: Profiling and BenchmarkingNext: Interior Mutability with RefCell