The following code is for questions 12 through 14
typedef struct {
char *firstname;
char *lastname;
int age;
} Person;
firstname lastname ageWe write a driver routine as follows:
#include "fields.h"
main()
{
Person **p;
IS is;
p = (Person **) malloc(sizeof(Person *)*10);
is = new_inputstruct(NULL);
for (i = 0; i < 10; i++) {
get_line(is);
p[i] = make_new_person(is);
}
...
}
Now, here is a skeleton of make_new_person(). Your job will
be to fill in the ``code fragments.''
Person *make_new_person(IS is)
{
Person *p;
Person p2;
Person parray[1];
/* Code Fragment 1: Initialize p */
/* Code Fragment 2: Initialize firstname and lastname */
/* Code Fragment 3: Initialize age */
return p;
}