C Struct Worksheet


  1. Write a struct called dog which has members for the name, owner, weight, and breed of a dog. Make all of your strings 30 chars (add an additional char for the null byte). Use a typedef to name the struct. Put your struct in the file dog.h.
  2. Write the following functions to work with your dog struct. Put the prototypes in dog.h and the implementations in dog.c:
  3. Write a main function that creates two dogs. Use your functions to set your dogs and then print them to the screen. Use stdout as the FILE pointer when printing. Put your main in the file main.c and include dog.h.
  4. Add the following functions to dog.h and dog.c
  5. Change your main to do the following:


Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2016