From d03e742a85c612d14371b0b6ef11269122e26437 Mon Sep 17 00:00:00 2001 From: ishan-sriv Date: Mon, 17 Dec 2018 21:34:37 +0530 Subject: [PATCH] Add lines 45-57 (infinite loop) to the article (#27051) --- guide/english/c/for/index.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/guide/english/c/for/index.md b/guide/english/c/for/index.md index e205ba5f364..0ef0c1e894a 100644 --- a/guide/english/c/for/index.md +++ b/guide/english/c/for/index.md @@ -76,30 +76,37 @@ main () return 0; } ``` -## Output: + +Output: ```shell * *** ***** ******* ********* +``` -`` +## Syntax of For Infinite loop +An infinite loop occurs when the condition will never be met, due to some inherent characteristic of the loop. An infinite loop also called an endless loop, and it is a piece of coding that lacks a functional exit so that it repeats indefinitely. +### Examples: - - -## Syntax of For infinite loop - -```c +```C for ( ; ; ) { statement(s); } ``` -An infinite loop occurs when the condition will never be met, due to some inherent characteristic of the loop. An infinite loop also called an endless loop, and it is a piece of coding that lacks a functional exit so that it repeats indefinitely. +```C +#include +int main () { + for (int i = 0; i < 5; i--) { + printf("%d \n", i); + } +} +``` ### Warning!