Add lines 45-57 (infinite loop) to the article (#27051)

pull/28478/head
ishan-sriv 2018-12-17 21:34:37 +05:30 committed by Christopher McCormack
parent 19ef5250e6
commit d03e742a85
1 changed files with 15 additions and 8 deletions

View File

@ -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 <stdio.h>
int main () {
for (int i = 0; i < 5; i--) {
printf("%d \n", i);
}
}
```
### Warning!