From the course: Debugging in C++ with Visual Studio Code

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Variables view

Variables view

- [Instructor] At the left, the topmost debugger element is the variables view. Here, we can see the state of all variables available in the scope of the current line about to be executed. So, here, we can see that i, the loop variable, has a value of 1, as expected. Then we have this, the current instance of the battery class, showing a memory address as its value, and then the hours parameter with a value of 24, which seems okay. Now, the current instance can be expanded. Let me show you. Now we can see its member values. charge is 100, as expected at the very first iteration of the loop. normalDrain is 5, and lowPowerDrain is 2. There you have it. We can confirm that everything looks okay at the first iteration of the loop. The variables view alone is an obvious alternative to print statements.

Contents