CS 240 Web Server
CS 240: C Programming
Professor Zhiyuan Li
Office: LWSN 3154H
Office hours: TR 4:30-5:30pm.
For general class issues that are not suitable for consulting on Piazz (see below), e.g. for appealing a grade, please send email to firstname.lastname@example.org to get a ticket.
Questions that are to be hidden from the TAs should be sent to the instructor at email@example.com.
TA office hours are held in the CS labs designated for this course. Please find all lab hours on MyPurdue.
Final Exam: Fri 05/03, 10:30a-12:30p, WTHR 200
Please double check with Purdue's web site to make sure there's no last minute change to the schedule or room.
We use Piazza for announcements (including TA contact info), course materials discussions and lab/project posting.
The web link can be found in Week 1's lecture notes (posted below).
Students will access their grades
Scope of this course according to the department's curriculum
The UNIX environment, C development cycle, data representation, operators, program structure, recursion, macros, C preprocessor, pointers and addresses, dynamic memory allocation, structures, unions, typedef, bit-fields, pointer/structure applications, UNIX file abstraction, file access, low-level I/O, concurrency.
Course objective according to the department's curriculum
Students understand programming principles and techniques for problem solving in the C programming language.
Class Policies and Workload
Please see Week 1's lecture notes (posted below).
As announced in class,
a minor revision to the policy on cheating cases is posted here. Feb. 4th, 2013
As announced in class email and posted here,
a new penalty level will be implemented for all cheating cases for the rest of the semester, starting with Lab 4 and Midterm 1.
(Feb. 18th, 2013)
All exams are close-book and close-notes.
Virtual Machine for Labs/Projects
If students work on labs and projects on computers other than those in our designated lab, we require them to use
this image of VMWare that contains all
software, tools, and libraries that you will need for your assignments. (This is to avoid the potential problem that codes developed on other machines do not work on the ones used to grade them.) The login and password necessary to access this image will be provided in the labs. Students who do not already have VMWare installed on their personal machines can do so by downloading VMWare player; this is a free download. Another free alternative is Virtual Box (which works for Mac OS).
The following book is our required text:
The C Programming Language, 2nd Edition,
Brian W. Kernighan and Dennis M. Ritchie
Class Schedule (tentative)
examples of Arrays of Arrays
- Week 1: Class policies, introduction (reading: Section 1.1 -- 1.5)
- Week 2: Basic program organization and data types ( Revised Jan. 17 ) (Reading: Chapter 1 -- 4) Lab 0 video made by TA
- Week 3: Machine representation of data types
Slides Part 1
Slides Part 2
(Re-reading: part of Section 1.6 -- 3.8) Lab 1
video made by TA)
- Week 4: Expressions, Statements, and Function Calls Slides Part 1 and Part 2 (Reading: Chapters 2 and 4)
video made by TA
Video (reviewing function calls)
- Week 5:
Precedence of Expressions, Structures, Arrays of Arrays, Memory allocation
(Reading: Chapter 5)
(Video made by TAs on control flow)
(on pointers )
- Week 6: Midterm 1 and reviews (Reading: ) (Lab 4 )
- Week 7: More on structures, unions, function pointers and bit operations (Reading: Chapter 6) ( Slides Part 1 ) ( Slides Part 2 )
(Video made by TAs
on C-unions and on Function Pointers , Lab 5
- Week 8: gdb, C-preprocessors, Makefiles (Reading: Section 4.11 ) Lecture Slides (Part 1) and (Part 2) Lab 6 A tar file containing several small examples as a start for the Lab assignment
- Week 9 File pointers, data format, floating point numbers.
Lecture Slides (quiz 6)
- Week 10: Spring Break
- Week 11: Processes, File systems, Project 2
- Week 12: Review (quiz 8)
- Week 13: processes and concurrency. (This week we mainly finish off the slides started Week 11, i.e. Week11.pdf.)
Project 3 ( quiz 9 )
- Week 14: Attaching child processes to GDB for debugging; Shared memory for interprocess communication Lecture slides (quiz 10)
- Week 15: Synchronization, Lecture Notes , Project 4 (quiz 11)
- Week 16: Review (quiz 12) Slides Part 1 and Part 2
- Final Exam Week
examples of Malloc
examples of struct and pointer arrays, etc
more examples on struct, unions and function pointers
Two examples of bit-wise operations
Examples on GDB
Examples of floating point representation
Examples of shared memory segments and semaphores