CS113: Introduction to C

Spring Semester 2006
When: January 23 - February 17 MWF 12:20 - 1:10p
Where: Hollister 206
Instructor: Erik Sherwood
Email: wes28 - at - cs.cornell.edu
Office: 657 Rhodes Hall
Office hours: TBA
Grading: S/U only

Announcements | Assignments | Lecture Notes and Schedule | Course Info | Useful links

Announcements

2/16 - Several announcements:

2/13 - Office hours this week: Wednesday 3-4, possibly Friday afternoon (announcement in class).

2/12 - Quiz related announcement: There was a typo in the notes for lecture 6 in the section on arrays of function pointers. I have posted a corrected version. Any questions related to arrays of function pointers on the quiz will not depend on knowledge of the typo or its correction in order for you to answer them correctly.

2/10 - Two announcements:

2/6 - Office hours this week are Wednesday, 2/8, from 3-4.

2/3 - Regarding homework submissions:

For problem 4, homework 2:

1/31 - Office hours this week: Wednesday 3-4 and by appointment.

1/27 - Compiling and running programs with Windows:

1/25 - Two announcements:

1/24 - The due date for the first homework is MONDAY, January 30.

1/23 - There are several announcements for the first class:

Top

Assignments

Homework 0 - due ASAP!
Homework 1 - due Monday, January 30
Homework 2 - due Monday, February 6
In Class Quiz - Monday, February 13
Homework 3 - due Monday, February 20

Homeworks should be submitted by 5 p.m. on the due date. You must turn in a PRINTOUT of your program(s) with your full name and netID either in class or in my mailbox in 657 Rhodes and email the source code to me. You do not need to submit any sample output for your programs. Follow the instructions included for each homework when naming the source code files that you submit.

Top

Lecture Notes and Schedule

This is a tentative schedule: the course plan may change, and the lectures may not follow the notes.

Lecture 1: Course details, example C programs
Reading: PCP Chapter 1; K&R Chapter 1 up to 1.8 inclusive

Lecture 2: Control statements
Reading: PCP Chapters 4,6,8; K&R Chapter 3 up to 3.7 inclusive

Lecture 3: Variables, data types, operators
Reading: K&R Chapter 2

Lecture 4: Functions and function activation records
Reading: PCP Chapter 9; K&R Chapter 4.1, 4.2

Lecture 5: Pointers and memory management
Reading: PCP Chapters 9 and 13

Lecture 6: Arrays, pointers, and strings
Reading: PCP Chapters 5, 13; K&R Chapter 5

Lecture 7: The C preprocessor, I/O in C
Reading: PCP Chapters 10, 14; K&R Chapter 7

Lecture 8: Type definitions and structures
Reading: PCP Chaters 12; K&R Chapter 6

Lecture 9: Dynamic memory allocation, dynamic data structures
Reading: PCP Chapter 17; K&R Section 7.8.5

Lecture 10: Odds and Ends
Reading: TBD

Top

Course Info

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.

All auditors/visitors are welcome.

Textbooks

There are two recommended textbooks for this course: Practical C Programming, by Steve Oualline, and The C Programming Language, Second Edition by Brian Kernighan and Dennis Ritchie. The first book is available online as a networked resource from the Cornell library, and both are on reserve at the engineering library. You aren't required to purchase either book. The Oualline book is probably a better introduction, though it has its problems, while the K & R book is a better reference for long-term use. C: A Reference Manual, by Samuel Harbison and Guy Steele, is also excellent if you anticipate doing much C programming in the future, but it is probably overkill to buy it just for this course. It is also on reserve at the engineering library.

Newsgroup

I do not plan to use the newsgroup for this course. Please direct all questions to me via email.

Compiler

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. It is found under Start->All Programs->Class Files->Codewarrior on the CIT lab computers.
  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.

Collaboration

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. You can help classmates debug their code, but you should not write code for anyone else, nor should you use code that others have written for you. 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.

Top

Helpful links

C/C++ Standard Library Reference Page

comp.lang.c FAQ

Memory Management Glossary

Blinky Pointer Fun Movie

Top