[Last Call] Learn how to a build a cloud-first strategyRegister Now


step by step global/local variable debugging

Posted on 2014-08-15
Medium Priority
Last Modified: 2014-08-18

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
Question by:rgb192
  • 5
  • 2
LVL 32

Expert Comment

ID: 40264704
>> 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.

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
LVL 32

Expert Comment

ID: 40264709
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:

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 Comment

ID: 40265034
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 32

Expert Comment

ID: 40265189
>> 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).
LVL 32

Accepted Solution

phoffric earned 2000 total points
ID: 40265215
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.
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.

Author Closing Comment

ID: 40265572
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

LVL 32

Expert Comment

ID: 40265598
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.
LVL 29

Expert Comment

ID: 40267827
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.)

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question