Skip to content
AgileLogics
4 min read

How C++ Differs from C

Prerequisites: Your first C++ program

A quick map of what's different before going further, assuming you've already worked through Learn C:

  • std::cout/std::cin replace printf/scanf (though printf still works — C++ remains almost entirely backward compatible).
  • std::string replaces manually-managed char arrays for text.
  • bool is a real, built-in type (not a <stdbool.h> add-on).
  • new/delete replace malloc/free for single objects (and are themselves mostly replaced by smart pointers, in Level 2).
  • References (int &r = x;) offer an alternative to pointers for many cases, covered next.
  • Classes add data and behavior together, instead of a struct plus separate free functions.

C++ is not a strict superset of C — a few valid C programs aren't valid C++ — but the overlap is large enough that C knowledge transfers almost entirely.