Assignment 3: CVector and CMap

Due date: Mon Feb 02 11:59 pm - Hard deadline: Fri Feb 06 11:59 pm

Assignment by Julie Zelenski

[Quick Links: Implementation details, Advice page, Grading]

Learning goals

Completing this assignment should provide you with:

  1. a clear understanding of the organization and management of raw memory
  2. extensive practice using low-level void* memory operations (malloc/realloc/free, memcpy/memmove)
  3. experience implementing a generic void* interface

Your assignment

Last time you were the client of CVector and CMap, this time you will implement CVector and CMap. It's simple enough to understand the goal, but handling the nitty-gritty internals of managing void*s will stretch your pointer skills to the limit. Start early. Draw pictures. Ask questions. Exercise on trivial test cases first. Use gdb and Valgrind early and often. Test more thoroughly than you have ever before in your life.

CVector implementation

CMap implementation

Requirements that apply to both


Read our page on how assignments are graded for background information on our grading process and policies.

Functionality (125 points)

Code quality (buckets weighted to contribute ~30 points)

Here we will read and evaluate your code in areas such as:

Getting started

The assign3 project contains the source files, our test programs, and a Makefile. Check out the starter project from your cs107 repo using the command

hg clone /afs/ir/class/cs107/repos/assign3/$USER assign3


When finished, use submit to turn in your code for grading. The sole output conformance requirement is to be sure there is no output of any kind from your operations. Double-check that you have removed/disabled all print statements-- any extraneous output can interfere with the autotester and cause loss of points.