CProjects - six short assignments to be implemented in the C programming language
CSSE 221 – Fundamentals of Software Development Honors
Fall 2008–2009

Work on these exercises individually, but be quick to get help as needed from your student assistants, your instructor and your classmates.

CProject: Dog (structures)

Overview

This project introduces you to structures. Key ideas include:

Instructions

  1. Construct new CProject that is an ANSI C Project called Dog.
  2. Add a new Header File to the src folder, choosing the "Default C header template" (not the C++ one) and calling the file Dog.h.
  3. #include "Dog.h" in Dog.c.
  4. In Dog.h, define a structure called Dog that has the following fields:
  5. In function main, declare a pointer to a Dog.
  6. Get your work so far graded, by your instructor, student assistant or a newly-promoted student assistant.
  7. Write and test the following pair of functions (put their prototypes in Dog.h):
  8. Extend your pair of functions to deal with the following (write and test them one by one, in the order listed):

    Assume (i.e. do NOT check) that the string arguments to constructDog are valid C-style strings. Also assume that the argument passed for the name is at most 6 characters. However, you must allow the breed and owner arguments to be strings of any length.

  9. Get your work so far graded, by your instructor, student assistant or a newly-promoted student assistant.
  10. Write a destructDog function that takes a Dog pointer and deallocates space for that Dog, including the malloc'ed space for its fields.
  11. Get your work so far graded, by your instructor, student assistant or a newly-promoted student assistant.
  12. Turn in your work by adding and committing your project to your individual repository.