• C

step by step global/local variable debugging

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
LVL 1
rgb192Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

phoffricCommented:
>> 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.
http://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
0
phoffricCommented:
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:
http://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.
0
rgb192Author 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
0
Introducing the "443 Security Simplified" Podcast

This new podcast puts you inside the minds of leading white-hat hackers and security researchers. Hosts Marc Laliberte and Corey Nachreiner turn complex security concepts into easily understood and actionable insights on the latest cyber security headlines and trends.

phoffricCommented:
>> 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).
0
phoffricCommented:
By default, CL assumes that files with the .c extension are C source files and files with the .cpp or the .cxx extension are C++ source files.
http://msdn.microsoft.com/en-us/library/032xwy55.aspx
The link also explains how to set flags to force the C compiler, but everyone I know simply use .c file extensions and not be concerned about flags.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgb192Author 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.
0
phoffricCommented:
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.
0
peprCommented:
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.)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.