From 4f4dedf4434ad2ebf53c2c6de71d1c5cef4d518d Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Sat, 2 Apr 2022 00:53:50 +0200 Subject: [PATCH] Update --- c_tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c_tutorial.md b/c_tutorial.md index 28d483d..ceb268e 100644 --- a/c_tutorial.md +++ b/c_tutorial.md @@ -248,7 +248,7 @@ Counting until 5... IMPORTANT NOTE: in programming we **count from 0**, not from 1 (this is convenient e.g. in regards to [pointers](pointer.md)). So if we count to 5, we get 0, 1, 2, 3, 4. This is why `i` starts with value 0 and the end condition is `i < 10` (not `i <= 10`). -Generally if we want to repeat the `for` loop *N* times, the format is `for` loop is for `(int i = 0; i < N; ++i)`. +Generally if we want to repeat the `for` loop *N* times, the format is `for (int i = 0; i < N; ++i)`. Any loop can be exited at any time with a special command called `break`. This is often used with so called infinite loop, a *while* loop that has `1` as a condition; recall that 1 means true, i.e. the loop condition always holds and the loop never ends. `break` allows us to place conditions in the middle of the loop and into multiple places. E.g.: