Basics / Syntax

Lessons in this group, roughly in build order:

  • variables-and-constants — A variable names a typed, mutable region of storage; a constant binds a name to a value that must not…
  • data-types — C++ has a small set of built-in (fundamental) types — booleans, characters, integers, and floating-point —…
  • type-modifiers — Keywords like signed, unsigned, short, long, const, and volatile adjust an existing type’s range, width,…
  • auto-and-type-inference — auto (C++11) tells the compiler to deduce a variable’s type from its initializer using template-argument…
  • operators — Operators are built-in symbolic functions — arithmetic, relational, logical, bitwise, assignment —…
  • conditionals-if-switch — if/else branch on a boolean; switch does a multi-way jump on an integral or enum value, often compiled to…
  • loops-for-while-do-while — C++ has three counted/conditional loop forms — for, while, do-while — plus break/continue to alter flow;…
  • range-based-for-loop — for (decl : range) (C++11) iterates any object exposing begin()/end() iterators, hiding the index…
  • comments — C++ has two comment forms — line // and block / / — stripped by the preprocessor before compilation; by…
  • input-output-iostream provides type-safe, extensible stream I/O via overloaded << and >> on std::cin, std::cout,…