How to add a breakpoint and debug your code in Visual Studio

How to add a breakpoint and debug your code in Visual Studio

Breakpoints are useful to see what your code is doing per line. This article steps though how to set breakpoint in Visual Studio

Breakponts are great for complex situations where you are counting though data in array or nodes or any other type of data structure.

Also this is great for debugging your code.

Below is steps of how to set breakpoints in your code and view what the code is doing in Visual Studio.

  • You can add a breakpoint by clicking side bar next to line of code. As image below

image.png

  • Then run your program
    • Open locals tab
    • You can see your array and what it has in it by inspecting local variables like below

image.png

  • See this link for more info on viewing whats in your array in visual studio

  • Step though code by pressing F10 which it will then change array

  • You can now see how you get a better understanding of what code is doing by stepping though your code

See this link for more info on setting breakpoints in visual studio

Happy Coding :)

Asrin

If this helped you consider buying me a coffee :)

References