Add lines 45-57 (infinite loop) to the article (#27051)
This commit is contained in:
committed by
Christopher McCormack
parent
19ef5250e6
commit
d03e742a85
@ -76,30 +76,37 @@ main ()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Output:
|
|
||||||
|
Output:
|
||||||
```shell
|
```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:
|
||||||
|
|
||||||
|
```C
|
||||||
|
|
||||||
## Syntax of For infinite loop
|
|
||||||
|
|
||||||
```c
|
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
statement(s);
|
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!
|
### Warning!
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user