What is an infinite loop?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alkakumari
    New Member
    • Dec 2010
    • 3

    What is an infinite loop?

    what is an infinite loop?
  • alexis4
    New Member
    • Dec 2009
    • 113

    #2
    Check this out.

    Comment

    • Shafi hashmi
      New Member
      • Dec 2010
      • 14

      #3
      An infinite loop is a loop whose condition is never satisfied.
      Eg.
      Bool isRunning = true;
      while(isRunning )
      {
      Console.WriteLi ne("running");
      }
      this loop will never ends (infinite loop)

      Comment

      • Nelson Joseph
        New Member
        • Dec 2006
        • 14

        #4
        infinite loop never ends.
        e.g
        Code:
        for(;;)
        {
        ...
        }
        (or)

        Code:
        while(1)
        {
        }

        Comment

        • horace1
          Recognized Expert Top Contributor
          • Nov 2006
          • 1510

          #5
          when programming embedded systems infinite loops are used all the time. e.g. when switched on a river level monitoring system goes into an infinite loop checking the water level and reporting regularly.
          The following is a fragment of code from a USB device (which can be connected to a PC USB port) based on a Microchip PIC24FJ64GB002 microcontroller
          Code:
              InitializeSystem();		// initialise USB and IO devices
              while(1)
              {		
                  USBDeviceTasks(); 	// poll USB interface for activity
                  ProcessIO();		// process any device specific IO        
              }
          in addition one also tends to have a watchdog timer which if the device gets into lockup state will restart the system.

          Comment

          • ddyer
            New Member
            • May 2010
            • 8

            #6
            refer to this thread:

            Comment

            Working...