Über A Book on Beginners for C Programming
During program designing there may be situation when we need to repeat a block of statement for n number of times; instead of writing it with the help of goto statement we can use looping statements. In looping, a sequence of statements is executed until some conditions for termination of the loop is satisfied. A program loop therefore consists of two segments, one known as body of loop and other known as the control statement. The control statement tests certain conditions and then directs the repeated execution of the statements contained in the body of the loop. Depending on the position of the control statement in the loop, a control structure may be classified as the entry-controlled loop or as the exit-controlled loop. In entry-controlled loop, the control conditions are tested before the start of the loop execution. If the conditions are not satisfied, then the body of the loop is not executed. Also known as pre-test loop. In exit-controlled loop, the test is performed at the end of the body of the loop and therefore the body is executed unconditionally for the first time. Also known as post-test loop.
Mehr anzeigen