C and C++ visualizer new features in 2026

Summary

In 2026 we implemented a lot of new features and fixed long-standing limitations in Python Tutor's C and C++ visualizer, including keyboard input, std::string and std::vector, function return values, inheritance, smart pointers, exceptions, VLAs, bit-fields, function pointers, and more. Most notably, now C++ works much better.

Here's all the major new C and C++ visualizer features we added in 2026 (most were done in November). Now C++ works much better than before. Each "see it" link opens an example in a new tab.

For what the visualizer could already do, see How the Python Tutor visualizer can help students in your C or C++ courses.

User input

  • C programs can read user input with functions like scanf, fgets, and getchar, then show how much text it has processed so far at each step. see it
  • C++ programs can read user input, with cin >>, getline, and others. see it

C++ string, vector, and other library types

  • std::string is shown as its text in quotes. see it
  • std::vector shows an array of elements, along with its size and capacity. see it; vectors can also hold compound objects and nested vectors.
  • std::array is drawn as the array it holds. see it
  • std::bitset shows its bits. see it
  • tuple, optional, variant show what they hold. see it
  • Iterators are shown as arrows to their elements. see it
  • Smart pointers (unique_ptr, shared_ptr, weak_ptr) are shown as arrows with use_count. see it
  • Lambdas are shown when passed into functions like std::sort. see it

C++ object-oriented programming

  • Constructors and destructors now show this and other parameters. see it
  • Inherited members show up, also with multiple and virtual inheritance. see it
  • Static members appear with globals. see it
  • A base-class pointer shows the object's real class. see it
  • Destructors show properly, even within arrays of objects. see it

C++ pass by value, reference, etc.

  • An object passed by value shows up as a copy in the called function. see it
  • References are labeled "reference to", and temporary values they refer to get own box. see it
  • References and const references passing into functions such as a const vector<int>& parameter. see it
  • Move semantics and rvalue references also work. see it
  • Exceptions show with arrow going from throw to catch, and caught exception shows message. see it

Newly-supported C functions and data types

  • sqrt, pow, and the rest of math.h work now. see it
  • Variable-length arrays. see it
  • Arrays sized by const int variables. see it
  • Flexible array members at the end of structs. see it
  • Bit-fields, each labeled with its width. see it or see its bits
  • Enums and bools shown as names like GREEN and true instead of numbers. see it
  • Complex numbers and 128-bit integers. see it
  • long double values are now shown. see it
  • Function pointers show the name of their function. see it

Pointers and memory

  • "don't show lone heap object as array" is a new C/C++ detail checkbox under the visualization. Checking it draws a single-value heap block as that value. see it
  • Every pointer now points where its type says, such as to a precise struct/union member. see it
  • Linked lists with typedef nodes draw properly. see it
  • A stack buffer overflow visibly changes the variable next to it to show bug. see it

Function calls and other control flow

  • Return values: when a function returns, its frame shows the return value (it wasn't able to do so until now!) see it
  • Parameters get their values at a function's first step instead of ?, which makes function calls less jarring to see. see it
  • Static local variables appear with globals and persist across different calls to the same function. see it
  • A loop written on one line takes one step per iteration. see it
  • The end of a C++ scope no longer jumps back up through each declaration to show destructor runs, since that looked confusing. see it

Remaining limitations

A detailed list is at C and C++ known limitations. For instance:

  • map, set, list, deque, stack, queue, and the unordered_ containers are shown as empty boxes.
  • There's no way to signal the end of input, so while (cin >> x) keeps asking for more user input.
  • std::function, lambdas stored in variables, and pointers into a std::string aren't drawn well.
  • Most C++20 features don't compile with gcc 9.3.

This article is part of the Python Tutor project (https://pythontutor.com)