1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>

int main(int argc, char* argv[]) {
    // STATIC array
    int array_static[3] = { 5, 6, 7 };

    int array_dynamic[];

    // Keep fetching numbers from the user as long as they are positive.
    int idx = 0;
    while(true) {
        int this_number = get_number_from_user();
        if(this_number > 0) {
            array_dynamic[idx] = this_number;
            idx += 1;
        }
        else {
            break;
        }
    }
    
    return EXIT_SUCCESS;
}
/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */

© Copyright 2021 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.