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

typedef  int  ThreeInts[3];  // create a type called 'ThreeInts' that is an array if three int's.

int main(int argc, char* argv[]) {
    
    ThreeInts triplet = { 1, 2, 3 };
    for(int i = 0; i < 3; i++) {
        printf("triplet[%d] == %d\n", i, triplet[i]);
    }

    ThreeInts triplet_of_zeros = { 0 }; // initialize all values to zero (guaranteed by C standard)
    for(int i = 0; i < 3; i++) {
        printf("triplet_of_zeros[%d] == %d\n", i, triplet_of_zeros[i]);
    }

    return EXIT_SUCCESS;
}
/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */

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