See this C reference and read n1570 or some newer C standard. Read also Modern C and study for inspiration the source code of existing free software coded in C, such as GNU make.
Expressions and statements are different.
Code:
for (i = 0; i < arr_size - 1; i++)
{
if (ar[i] == 1 || ar[i] == 2 || ar[i] == 3)
count++;
else
continue;
}
Given that else continue
is the last thing in the loop, you could omit it.
Hint: compile your C code with a recent GCC compiler invoked as gcc -Wall -Wextra -g
.
Read the documentation of your C compiler (e.g. GCC) and your debugger (e.g. GDB).
If so allowed, use static source code analysis tools like the Clang static analyzer, or Frama-C, or Bismon or the DECODER project.
(For both Frama-C and Bismon and DECODER, contact me—in 2021—by email to basile.starynkevitch@cea.fr.)