#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct person_ {
    // Hmmmm, not good enough to have fixed name sizes
    char first_name[20];
    char family_name[20];
} person ;

int main() {
    person *p;
    int i;

    p = calloc(100, sizeof(person));
    if (p==NULL) {
        fprintf(stderr, "Failed to allocate memory!\n");
        return 1; // indicate errror to user
    }

    for (i=0; i<100; i++) {
        // sprintf is ok in this case - we know what we have
        sprintf(p[i].first_name, "%s the%dth", "Henry", i);
        strcpy(p[i].family_name, "Rollins");
    }

    /*
       Now you should assume there are 100 more persons and give them names
       as well. This will lead to you using accessing memory you have not
       allocated.
    */
    for (i=100; i<200; i++) {
        sprintf(p[i].first_name, "%s the%dth", "Henry", i);
        strcpy(p[i].family_name, "Rollins");
    }

    free(p);
    return 0;
}
