The Adventures of Malloc and New

Instructors: Jean Yang and Eunsuk Kang
{jeanyang, eskang}


Ever hang your head in shame after your Python program wasn't as fast as your friend's C program?  Ever wish you could use objects without having to use Java?  Join us for this fun introduction to C and C++!  We will take you through a tour that will start with writing simple C programs, go deep into the caves of C memory manipulation, resurface with an introduction to using C++ classes, dive deeper into advanced C++ class use and the C++ Standard Template Libraries.  We'll wrap up by teaching you some tricks of the trade that you may need for tech interviews.

We see this as "C/C++ empowerment" course: we want you to come away understanding

  1. why you would want to use C over another language (control over memory, probably for performance reasons),
  2. why you would want to use C++ rather than C (objects), and
  3. how to be useful in C and C++.


We target this course to those with some degree of comfort programming (in Python, Scheme, Java, etc.) who want to become comfortable with using C/C++.  No C/C++ experience expected.


The course will take place 7-8:30 PM in 32-141 January 19-22 (Tuesday-Friday) and January 25-26 (Monday-Tuesday). There will be moderate amounts of homework (no more than 2-3 hours per day on average) to solidify understanding of the material.

Jean will be giving lectures 1-3; Eunsuk will be giving lectures 4-6. Both Jean and Eunsuk will be present for the Q&A on Day 6.

Course Outline:

Day 1: Motivation for using C/C++; discussion of where C/C++ sit in the abstraction hierarchy; writing our first C programs.  Homework (due Wednesday, Jan. 20):

Day 2: The logistics of memory manipulation in C (pointers; structs). Homework (due Thursday, Jan. 21):

Day 3: More advanced memory manipulation in C.  We'll show double linked-list insert in place, inserting into a linked list using a double pointer, corner cases of using memory (when we actually need heap allocation), etc. Homework (due Friday, Jan. 22):

Day 4: introduction to C++; encapsulation -- classes, namespaces, constructors and destructors; memory management in c++ (new, delete); operator overloading and standard input/output.

Day 5: inheritance and polymorphism; templates; standard library containers. Homework will include quiz-type questions, that will be discussed during the last lecture

Day 6: Tricks of the trade.  Things people might see in interviews etc. Review and discussion of the covered topics, Q&A