#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "person/person.h"

int main(int argc, char** argv) {
  int i;
  person *p;

  i=1;
  p=NULL;
  
  while(i<100) {
    person *tmp = realloc(p, (i)*sizeof(person));
    if (tmp==NULL) {
      fprintf(stderr, "Failed to allocate memory, bailing out\n");
      break;
    } else {
      p = tmp;
      strcpy(p[i-1].first_name,  "Henry");
      strcpy(p[i-1].family_name, "Rollins");
      i++;
    }
  }


  fprintf(stderr, "p: %p\n", (void*)p);
  free(p);
  p=NULL; 
  
  return 0;
}
















/*




  
  }

    (*p).name is the same thing as p->name
  strcpy((*p).first_name, "Henry");

  strcpy(p->family_name, "Rollins");

  strcpy(p[1].first_name, "Henry"); 
  strcpy(p[1].family_name, "Chinaski"); 

  printf (" %s %s\n", (*p).first_name, p->family_name);
  //  printf (" %s %s\n", p[1].first_name, p[1].family_name);
  
  //  free(p);
  
}

*/
