Programming Foundations (503208)

School of Computer Science, Universidad de ConcepciĆ³n

Prof. Leo Ferres

Course information
Materials and Resources
Picturesque notes and acknowledgments

Course information


This is the first "real" Computer Science course in the CS degree at UdeC. And it is my personal favorite. I've programmed computers since I was nine years old, on a Czerweny 1500, an Argentinean clone of the Timex Sinclair 1500 computer, first introduced in 1983. I've loved it ever since.

The objective of this course is to give you the most basic tools you need to understand programming. However, this is not your run-o'-the-mill, vanilla, Java-ish programming course. It will not teach you (many) good practices of software engineering, nor will it teach you how to be a good programmer (who could in a Semester, anyway). What it will do is teach you to understand how a computer does what you tell it to do through a computer programming language. Programming is not black magic, and computers are not black boxes, my job in this course is to make both transparent.

We will use C, but the syntax is irrelevant. I could have picked any programming language. However, C gives me the control and it is lean enough to teach you the concepts I want to teach you. In fact, if I am successful teaching you those concepts, at the end of this course you will be able to easily learn any computer syntax with minimum effort (well, maybe not Prolog... but still).

Have fun in your journey, and happy coding.

A digression: If you get a mark >= 6.1, you get to be invited to WEFU. WEFU (Weird & Funny Algorithms Seminar) is a by-invitation-only

workshop, held the first term of each calendar year, where you learn stuff more in-depth by solving an (as of yet unimplemented) algorithm. There's usually five or six people in WEFU every year, the best three will become 503208's TAs the year following their WEFU attendance.

Course staff and information

Contacting the staff: Best way to get a hold of us is to send email to all of us (TA's and myself) and you will have three times the chances of being replied to. TAs, being more responsible, will probably be in their office, so go bother them. If you absolutely have to bother me, best way to contact me is via email. You can call my office, come and bang on my door, whatever, but I enjoy being alone, and I'm usually away from my desk, working from somewhere else. So try not to.


Unit 1: Types, operators and expressions

Unit 2: Control structures

Unit 3: Arrays and Pointers

Unit 4: Structures Dynamic Memory allocation



Miniquizzes are short (1 or 2 questions) quizzes that will be done daily at some point during class. These have no mark associated to them (you cannot "fail" them), but you can only miss 3 of them. If you miss 4, you automatically receive a NCR mark, even if you've passed all other evaluations with the highest mark. This is to ensure continuity of your learning experience.

Major Assignments (30% of the final mark)

There will be three assignments, due on the dates below. Two files will be required:

You will be required to post your files in a .tar.gz file through infoalumnos. The .tar.gz file must be named after your student number and the suffix Ax, where x is the assignment number (1, 2, or 3). E.g. 202012344A1.tar.gz refers to student 202012344, who handed in assignment 1. After running make in your directory, the file should produce a pdf output and a compiled program (see the Makefile for instructions).

You have to pass the three assignments with an average (A1+A2+A3)/3 >= 4. There are no "bonus" assignments.

The way I mark the assignments is as follows: I do three input tests. One of them, the first one, is the example test. Everyone should get this right! (if not, it means you didn't do it, or you didn't really compile it, etc.) The other two are novel examples. The marking guide (or "pauta") is the following:

Two exams (50% of the final mark)

A 1.5-hour "traditional" midterm exam covering everything from Units 1 to 3. This midterm exam is worth 40% of the 50%.

A 3-hour "traditional" exam worth 60% of the 50% covering all the material presented in class and labs. This exam will not be about certain points individually, but will test the integration of the knowledge you should have acquired.

Here are examples of previous Midterm exams:

Lab exam (20% of the final mark)

There will be a lab exam (an exam written in front of a computer with TAs in the room) in the last lab session.

Scribing (1% Bonus Mark, Optional)

Scribing one, maybe two, lectures (in Spanish). See the lectures page for more details. Note in particular that scribe notes are due on the day of the next lecture. The entire calendar for the course has been posted, so you can select a lecture that interests you. We will circulate a sign-up sheet during the second week. This is a nice way to complement your probably already low mark.

There's no penalty for not transcribing the lecture.

We still need transcriptions for Lectures 11, 14, and 15.

Materials and Resources


We don't have a textbook, really. However, all the material is heavily based on Kernighan and Ritchie's second edition of The C Programming Language, which we refer to as K&R. There are copies on reserve at the library (in Spanish!).

We also use the The C11 Standard, which we call the n1570 book (for historical reasons.)

For each book, we usually give the corresponding sections (like 1.1) instead of pages, because the latter may vary from copy to copy.

I will provide handouts with my notes for each class. Much more material is put in those notes, and it is those notes (plus labs) that you will be evaluated on.

Anything covered in class or in the notes or in labs or in the book can be evaluated.


In this course, we use the following technologies: Linux, Emacs, C, Latex, Noweb, GDB. You will learn about these technologies during the lab sections.

You will have to install a version of the Linux operating system by yourself, or use the computers in the lab. My preferred Linux distribution is Xubuntu. Once you have that working, you need to issue the following commands to get your system up to speed for the course.

(1) Emacs is my editor of choice. I've required its use since I started teaching this course. However, it is now optional. Just find for your own (clean) text editor (not an IDE!) and use it. I obviously won't be able to provide any help with anything but Emacs. You're on your own if you get stuck. Also, code will be demonstrated using Emacs. In any case, a good, simple text editor is gedit. There are others, ranging from kiddy text editors to very esoteric such as Acme or Ed.

Supporting material

Here are some "cheat sheets" or "reference cards" that summarize how to use each program.

Free C books:

GCC books

Picturesque notes and acknowledgments

2013-03-15-16:25: Most of this layout, including the idea of recording the lectures and the "handwritten" notes were inspired by Erik Demaine. He does the same thing at MIT. So thanks to him for publishing his lectures online, and for writing the guide. I'm nowhere as smart as he is, but I think we would both agree that, irrespective of politics, knowledge must be free.

2013-01-26-09:36: I've been teaching LP1 since 2008. It's my favorite "general undergraduate course". I enjoy most of the material I have to teach here. This is the first course I will have filmed with actual students in it, in the Software Engineering Lab at UdeC. The first time around, I requested they use Emacs as a text editor, and noweb to hand in their homework. Since then, I've become more lenient, and they can choose the text editor they will use. They use C as the language, work with a text editor, gcc and the console. And yes, my first programming language was BASIC, I learned GW Basic. Problem, Dijkstra?