We help IT Professionals succeed at work.

step by step global/local variable debugging

rgb192
rgb192 asked
on
295 Views
Last Modified: 2014-08-18
http://www.swarthmore.edu/NatSci/tali/E15/Visual_C.html

I can run a c file using

visual 2013 express which can be downloaded at  http://www.microsoft.com/en-us/download/details.aspx?id=40787.

but how can I see global/local variables variables

only thing I can do is run .c file

I would like step by step debugging
please do not recommend eclipse or netbeans because those are different experts exchange questions which I can not get to work
Comment
Watch Question

CERTIFIED EXPERT

Commented:
>> I would like step by step debugging
>> how can I see global/local variables variables

Take a look at this article to see if you can follow these steps. If you get stuck on a step, then let me know. Below, I've listed a few keyboard commands that may help you get started even if you do not read the article.
https://www.experts-exchange.com/Programming/Languages/CPP/A_2688-Microsoft-Visual-Studio-2008-Express-C-Quick-and-Dirty-Debugger-Tutorial.html

TABLE OF CONTENTS
1. Building Program with Symbolic Debugging
  1.1. Building in Debug Mode
  1.2. Building a C Program
2. Program Navigation
  2.1. Breakpoints
  2.2. Starting the Program and Hitting Breakpoints
  2.3. Stepping Through the Program
  2.4. Setting the Next Statement to Execute
  2.5. Caveat: Console Interaction with Debugger
3. Examining and Modifying Variable Values
  3.1. Mouse Hovering Reveals Values and Structure
  3.2. Quick Watch
  3.3. Autos and Locals Tab
  3.4. Modifying a Variable Value
4. Command Line Arguments
5. Stopping the debugger


Summary of Keyboard Commands Used in this Article
F5   – Start Debugging; or continue Debugging
F10 – Step over next line
F11 – Step into function or method
F9   – Set/Unset Breakpoint

<Ctrl+Shift+F5> –  Restart Program Debugging
<Ctrl+Shift+F10> –  Set position of next statement to execute
CERTIFIED EXPERT

Commented:
After you feel comfortable with the article in my previous post, you may wish to learn more about special features in setting breakpoints to make your debugging experience more productive. If so, read this article:
https://www.experts-exchange.com/Programming/Languages/CPP/A_3530-Breakpoint-Tips-for-C-C-Visual-Studio-2008-Debugger-Part-2.html

TABLE   OF   CONTENTS
1.  Conditional Breakpoints
2.  Hit Count Breakpoints
3.  Touch and Go Breakpoints (a.k.a. Tracepoints)
4.  Exception Breakpoints

  4.1.  Change How the Debugger Handles an Exception
  4.2.   Adding a User Defined Exception
  4.3.   Breaking on a User Defined Exception
5.  Run To Cursor (Create a Temporary Breakpoint)
6.  List of Breakpoints


You may be surprised how easy it is to learn to use the Visual Studio Express debugger.

Author

Commented:
I read the 3 articles and
I got the debugger working
how can I be sure I am doing the debugging for c (instead of c++)
is creating a .c file in the source directory ensure that I am using c debugger
CERTIFIED EXPERT

Commented:
>> is creating a .c file in the source directory ensure that I am using c debugger
Yes, provided that all the files in your project have a .c extension (or header extension).
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I change project properties
c++ folder
compile as c code

and I will post errors in future questions or stick with just .c filenames which is your other solution

Thanks.
CERTIFIED EXPERT

Commented:
Your choice as to how to force C-language using VS 2013.
At the workplace, we have never changed properties. We always use the .c extension for C source. This is a VS quirk. In Linux, you better explicitly pick the right compiler which doesn't care what the extension is.
CERTIFIED EXPERT

Commented:
I suggest to start with C++ istead of C. (I know I may be fried in a flamewar, but I believe C++11 is better for beginners than the plain C. And you can do everything that you can with C.)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.