Results 1 to 2 of 2

Thread: What are debugging Rules for C program?

  1. #1
    Senior Member Tarah's Avatar
    Join Date
    Jun 2012

    What are debugging Rules for C program?


    How to debug a program? Can anyone give some tips to debug a program in C?

  2. #2
    Senior Member Bandhavi's Avatar
    Join Date
    May 2012
    As of my knowledge here I am providing you some tips for debugging your c program

    1. Assume nothing. Do not assume that a variable has the correct value, even if
    we see that the variable is assigned a value.

    Print the value of the variable in the down time.

    Elsewhere in the program cannot be sacked.

    2. When the value of a variable to something unexpected, check the logical tests to see if they have inadvertently put a value instead of tested.

    3. Take a break. When you work on something else for a while, usually suddenly you will realize the cause of origin.

    4. If the fault is not in the code section that was originally suspected, which is somewhere otherwise.

    Do not fall into the trap of thinking, "Error cannot be in this part code, because I checked.

    5. Fix all compiler warnings. Set the alert level as high as possible.
    If you write Windows programs, use strict to ensure maximum

    6. Pointers cause most problems. Array-held replace almost many problems. Strings are arrays. In most C compilers, all detected at limits are exceeded chain.

    If the chain is on the stack, when its limits are exceeded (as it is an automatic variable), the program will probably do some strange things.

    7. Backup of your disk. One of my first C programs quickly broke my record.

    The one blessing is that I did not have a backup program that made the
    the dirty work was done!

    8. Sometimes there are compilation errors, but generally not the reason the program fails.

    9. Another look at its programming code C.

    10. When all else fails, rewrite the code to work differently.

    You are not guaranteed a perfect program, just because you avoid these common elements

    The most common error is the error the program simple logic.

    The program does work as you think.

    The program is syntactically correct and has not programming errors, but their logic is incorrect.

    With hard work, a debugger, and patience, you can follow the progress of the program.

    Finally, one can find the point where results are not what they expected, and perhaps the error.

Similar Threads

  1. Difference between Software Testing and Debugging
    By Manoj Tiwari in forum Testing
    Replies: 1
    Last Post: 09-20-2012, 09:28 AM
  2. Debugging Question
    By Tarah in forum Programming languages
    Replies: 0
    Last Post: 09-09-2012, 07:45 AM
  3. Unit Testing Rules
    By sarvani in forum Testing
    Replies: 1
    Last Post: 05-25-2012, 09:37 AM
  4. Forum rules and guidelines
    By vijaydurga in forum Forum Rules
    Replies: 0
    Last Post: 05-24-2012, 09:04 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts