Traversing an array (for)
Processes array elements with a loop.
Syntax
for (int i = 0; i < n; i++)
Description
In C, you don't automatically know the size of the array; you keep track of the count yourself.
Example
Loading editor…
Expected output
5 10 15
When to use?
Sum, search, processing.