Content health: prewriting stage
This chapter is not yet finished. To speed up the progress, help us fix it at GitHub.

Arrays, loops, and break

Array can be imagined as a container with a fixed number of elements, where each element is indexed from 0 incrementally:

| Array element | H | e | l | l | o | | Array index | 0 | 1 | 2 | 3 | 4 |

Let's check a code example:

#include <stdio.h>

char *strings[5];

int main() {
    int i;

    strings[0] = "H";
    strings[1] = "e";
    strings[2] = "l";
    strings[3] = "l";
    strings[4] = "o";

    for (i = 0; i < 5; i++) {
        printf("%s\n", strings[i]);
    }
}


Found a typo? Something wrong with this content?

Just fork and edit it.

Content of this work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Code snippets in examples are published under the CC0 1.0 Universal (CC0 1.0). Thanks to all contributors.