#include<stdio.h>

/**
 * Terry Harvey CIS 105 Section 010 TA Tina Weymouth
 *  Demonstration program for structs
 **/

typedef struct{
    int num_legs;
    //int aspamn = 8; illegal to initialize
    char name[20];
} Pet;  //this makes a new type called Pet

void printPet( Pet p );
Pet makePet();

int main(){

    Pet p1;
    Pet p2 = {4, "Mildred"};
    p1.num_legs = 4;

    p1 = p2;

    printPet( p1 );
    p2 = makePet();
    printPet( p2 );
    return 0;

}

Pet makePet(){
    Pet p;
    printf("enter a number of legs and a name: ");
    scanf("%d%s", &p.num_legs, p.name);
    return p;
}

void printPet( Pet p ){
    printf("p has %d legs and is named %s.\n", p.num_legs, p.name);
    return;
}




