Ch 9 · Vectors & Strings · C++

Topic 9 of 13 in C++ — Complete Tutorial (Beginner) — 2 lessons.

std::vector

A vector is C++'s growable array from the STL — far safer and easier than C-style arrays. It knows its own size, grows automatically with push_back, and you access elements with [index] (starting at 0). Vectors are the default container for a list of values in modern C++; reach for one whenever you need a sequence you can add to.

std::string

C++'s string class makes text easy and safe, unlike C's char arrays. You can join strings with +, compare them with ==, get the length with .length(), and use many built-in methods. Strings grow automatically and manage their own memory, so you never worry about buffer sizes or null terminators.

All topics in C++ Beginner

  1. Introduction to Programming & C++
  2. Your First C++ Program
  3. Variables & Data Types
  4. Input & Output
  5. Operators & Expressions
  6. Conditional Statements
  7. Loops & Iterations
  8. Functions
  9. Vectors & Strings
  10. Classes & Objects
  11. Working with Classes
  12. Exception Handling
  13. Mini-Projects & Practice