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

This commit is contained in:
ishan-sriv
2018-12-17 21:34:37 +05:30
committed by Christopher McCormack
parent 19ef5250e6
commit d03e742a85

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!