<!-- hamlet
<!-- copytar
examples/                                                                                           0040755 0002611 0000666 00000000000 06355554330 0013536 5                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        examples/struct2.c                                                                                  0100644 0002611 0000666 00000001545 06355554326 0015317 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
#include <stdio.h>


struct person_info {
  char first[100];
  char last[100];
  int age;
  int ssn;
  float salary;
};



/* This prompts for and reads information about a person. */

struct person_info readPerson () {
  struct person_info p;
  printf("First name: ");
  gets(p.first);
  printf("Last Name: ");
  gets(p.last);
  printf("Age: ");
  scanf("%d", &p.age);
  printf("Social security number (no hyphens): ");
  scanf("%d", &p.ssn);
  printf("Salary: ");
  scanf("%f", &p.salary);
  return(p);
}


/* This writes out information about a person. */

void writePerson (struct person_info p) {
  printf("%s %s, %d years old, SSN %d, salary of $%9.2f\n",
         p.first, p.last, p.age, p.ssn, p.salary);
}


/* Reads in and writes out information about a person. */

void main () {
  struct person_info p;
  p = readPerson();
  writePerson(p);
}
                                                                                                                                                           examples/struct1.c                                                                                  0100644 0002611 0000666 00000001762 06355554326 0015317 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
#include <stdio.h>


/* This prompts for and reads information about a person.  Everything
   is returned though the parameters, which are passed by reference. */

void readPerson (char *first, char *last,
                 int *age, int *ssn, float *salary) {
  printf("First name: ");
  gets(first);
  printf("Last Name: ");
  gets(last);
  printf("Age: ");
  scanf("%d", age);
  printf("Social security number (no hyphens): ");
  scanf("%d", ssn);
  printf("Salary: ");
  scanf("%f", salary);
}


/* This writes out information about a person. */

void writePerson (char *first, char *last,
                  int age, int ssn, float salary) {
  printf("%s %s, %d years old, SSN %d, salary of $%9.2f\n",
         first, last, age, ssn, salary);
}


/* Reads in and writes out information about a person. */

void main () {
  char first[100];
  char last[100];
  int age;
  int ssn;
  float salary;

  readPerson(first, last, &age, &ssn, &salary);
  writePerson(first, last, age, ssn, salary);
}
              examples/struct3.c                                                                                  0100644 0002611 0000666 00000001546 06355554326 0015321 0                                                                                                    ustar 00hamlet                          hamlet                          0000235 0000202                                                                                                                                                                        /* level 5 */
#include <stdio.h>


struct person_info {
  char first[100];
  char last[100];
  int age;
  int ssn;
  float salary;
};

typedef struct person_info person;


/* This prompts for and reads information about a person. */

person readPerson () {
  person p;
  printf("First name: ");
  scanf("%s", p.first);
  printf("Last Name: ");
  scanf("%s", p.last);
  printf("Age: ");
  scanf("%d", &p.age);
  printf("Social security number (no hyphens): ");
  scanf("%d", &p.ssn);
  printf("Salary: ");
  scanf("%f", &p.salary);
  return(p);
}


/* This writes out information about a person. */

void writePerson (person p) {
  printf("%s %s, %d years old, SSN %d, salary of $%9.2f\n",
         p.first, p.last, p.age, p.ssn, p.salary);
}


/* Reads in and writes out information about a person. */

void main () {
  person p;
  p = readPerson();
  writePerson(p);
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          