14 lines
343 B
Markdown
14 lines
343 B
Markdown
# 11.1. Mistake
|
|
|
|
> Find the mistake(s) in the following code
|
|
|
|
```c++
|
|
unsigned int i;
|
|
for (i=100; i>=0; --i)
|
|
printf("%d\n", i);
|
|
```
|
|
|
|
One mistake is syntax in the for, it lacks {}. The printf is taking a digit but i is unsigned int.
|
|
|
|
Unsigned int is always greater than or qual to zero, it will remain in 0 and the loop will run infinitely.
|