Thread: Need help to find a bug

  1. #16
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Quote Originally Posted by thestien View Post
    very true but as im new to this i dont understand how the condition ( ; i-- ; )
    works? perhaps ( i = nc; i>0(or how ever many loops u need);i--)
    To reflect your original loop in a traditional way, you'd do something like:
    for( i = nc; i>=0;i--) ...
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    very true but as im new to this i dont understand how the condition ( ; i-- ; )
    does it mean if ( i ) is one less than the previous loop?
    No, in terms of the loop condition it means: while (i != 0). Then you consider that there is a post-decrement in effect.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #18
    Registered User
    Join Date
    Dec 2005
    im still confused how for(i=nc; i--; ) is the same as while(i != o)
    is there a link you know that i could read up on that?
    Last edited by thestien; 05-09-2008 at 04:17 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ATL bug of CComPtr?
    By George2 in forum Windows Programming
    Replies: 6
    Last Post: 04-07-2008, 07:52 AM
  2. Can't Find Bug in basic MP3 Sorter
    By trickeastcs in forum C++ Programming
    Replies: 12
    Last Post: 12-14-2007, 05:31 PM
  3. Replies: 5
    Last Post: 04-16-2004, 01:29 AM
  4. Time for another round of: FIND THAT BUG!
    By Geolingo in forum C++ Programming
    Replies: 0
    Last Post: 10-29-2003, 05:29 AM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM