CS113: Introduction to C

Spring Semester 2005
When: January 24 - February 18 MWF 12:20 - 1:10p
Where: Hollister 401
Instructor: Kevin O'Neill
Email: oneill+cs113@cs.cornell.edu
Office: Upson 344
Office hours: WEDNESDAY 1:30 - 2:30, or by appointment
Grading: S/U only

Lecture Notes & Schedule
Homework 0 - due ASAP!
Homework 1 - due Friday, January 28
Homework 2 - due Friday, February 4
Homework 3 - due Friday, February 11
Homework 4 - due Friday, February 18

Course Content

The goal of this course is to teach the fundamentals of the C programming language. By the end of this course, a student should have sufficient mastery so that details of the language not discussed in the class can be learned independently by reading a book (such as "The C Programming Language" by Kernighan and Ritchie). In addition, by the end of the course students should feel comfortable writing simple C programs, and have working experience with all major C features.

I will assume that you have taken a college-level programming course at the level of CS100.

Please do not take this class if you do not anticipate being able to attend the lectures, or if you don't think that you'll be able to turn in all of the assignments on time. Also, please let me know if you plan to miss class, so that I can let you know if you're missing anything important.

All auditors/visitors are welcome.


There are two recommended textbooks for this course: "Practical C Programming", by Steve Oualline, and "The C Programming Language" by Brian Kernighan and Dennis Ritchie. The first book is available at the bookstore, and both are on reserve at the engineering library. You aren't required to purchase either one. The Oualline book is probably a better introduction, though it has problems, while the K & R book is a better reference for long-term use.


There is a newsgroup for the course: cornell.class.cs113. The Cornell newsgroup server is newsstand.cit.cornell.edu. If you have questions of a general nature, please post them to the newsgroup. (To post messages, use your NetID and your NetID password when prompted.)


In this course, you may use any compiler that compiles ANSI C code. In particular, you may use the gcc compiler that is standard with UNIX/Linux/MacOSX. If you have access to gcc and you have a good text editor like emacs (or are willing to use Notepad), this option is much easier and simpler than using CodeWarrior.

Here are instructions to help you get started writing a C program using CodeWarrior on a PC (version 8):

  1. Load the CodeWarrior IDE.
  2. Select File:New.
  3. Select "Win32 C Stationery" under Project, enter a project name, and then click OK.
  4. Select Win32 WinSIOUX App, and click OK.
  5. Click on the plus to the left of "Source", and then double-click on main.c.
  6. Now you're cooking. Edit main.c to your heart's content. To run or debug your program, click on the green arrows in the project window, or alternatively select Project:Run or Project:Debug.
  7. Don't forget to save your file periodically!
Here's a guide to CodeWarrior (in postscript format). Note that it was written for Macintosh users, so some parts may be Macintosh specific.


You may discuss your work with classmates on a high level but the work you turn in must be your own. You should definitely understand everything that you turn in as if you had done all the work yourself. If you have any questions about this policy, please ask me. The Cornell University Code of Academic Integrity provides more details on these issues.

Keep in mind that CS113 is a self-selecting, noncompetitive course, so cheating is particularly pointless, given the associated risks.

Helpful links

C/C++ Standard Library Reference Page

comp.lang.c FAQ

Memory Management Glossary