Thread: Why is the while loop still executing?

  1. #1
    Registered User
    Join Date
    Oct 2019

    Why is the while loop still executing?

    int main()
    unsigned int rowIndex = 0;
    int nRow = -1;
    while (rowIndex < nRow)
    printf("%d\n", rowIndex);
    return 0;

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    nRow is converted to unsigned int, so it becomes the largest unsigned int value.
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Executing For Loop
    By mshel130 in forum C Programming
    Replies: 4
    Last Post: 09-26-2011, 05:56 AM
  2. Executing an ELF
    By abachler in forum Linux Programming
    Replies: 3
    Last Post: 01-20-2009, 03:14 PM
  3. Replies: 40
    Last Post: 09-01-2006, 12:09 AM
  4. Executing in DOS...
    By Jperensky in forum C Programming
    Replies: 5
    Last Post: 03-16-2002, 03:33 AM
  5. executing
    By xlordt in forum C Programming
    Replies: 1
    Last Post: 01-05-2002, 08:56 AM

Tags for this Thread