1. Technology

How to Compile Programs with Microsoft Visual C++ 6


7 of 8

Stepping Through Program Execution
Stepping Through code

F10 and F11

Both of these step the program forward by one line. The current line is highlighted by the yellow arrow in the picture. The red spot is a breakpoint.

The difference between F10 and F11 is how functions are dealt with. F10 will call the function and move on to the next line, whereas F11 will step into it.

When the cursor is on either of the std::cout lines, pressing F11 will enter Ostream, the library that implements cout. You should avoid system files until you are more proficient and comfortable with templates. Remember when you don't want to step into a function press F10.

If you do step into a function by mistake, don't panic. Just press Shift+F11, to take you to the end of the function.

The Debugger Windows

The "variables" window shows all the local variables. When stepping through the main function, you'll also see argc and argv which are command line parameters passed into an application.

The "Calling Stack" shows which function called which. When you are many levels deep this can be a life saver. Press F11 on a cout statement to see this. As the debugger enters the function code, another level is added to the "Calling Stack" window.

The "watch" windows lets you watch variables, useful when those variables are no longer visible in the "variables" window. You can type or cut and paste the variable name into the window.

On the next page : Complete this lesson with a quick look inside .dsp and .dsw files.

Related Video
How to Share Files between your Mac and PC
  1. About.com
  2. Technology
  3. C / C++ / C#
  4. C++ Programming
  5. Learn C++ Programming
  6. Stepping Through Program Execution

©2014 About.com. All rights reserved.