C Programming Part I X52.9232

Section 1 Syllabus

This course introduces every feature of the language C:
  1. control structure, in the spirit of the control structure chapter of Kernighan and Plauger's Elements of Programming Style
  2. data types: variables and how to input and output them; declarations, literals
  3. expression evaluation: operators and their arity, precedence, and associativity
  4. arrays and pointers: looping through an array with a pointer instead of with an integer index
  5. functions: declaration vs. definition; passing arguments by value and by reference; return value; dividing the program into more than one source file
  6. structures: arrays of structures, pointers to structures, looping through an array of structures with a pointer to a structure instead of with an integer index
  7. dynamic memory allocation: malloc, realloc, and free
  8. the standard i/o library: fopen and fclose, fprintf and fscanf, sprintf and sscanf
  9. a hint of recursion and higher-level data structures
We end with a glimpse at a linked list made out of individually allocated structures linked with pointers. There's no time for any non-linear data structure that would actually require recursion to traverse.

The coverage of pointers to structure will leave students well-equipped for the first step in using objects in C++: calling member functions. The following features are covered only very lightly: unions, bitfields, and multi-dimensional arrays.

Of course, to program usefully in C you need more than an introduction to features. For example, this course will teach you what a "pointer" is, and where to write the asterisks and ampersands to avoid a syntax error. But only lots of supervised experience can teach you when and how to use a pointer to make your code smaller, faster, or simpler. Ditto for arrays, structures, and even the humble "if" statement.

This course is operating system independent. This means that we cover only the language C. We do not cover how to log into your computer, or how to create, save, compile, link, or run a C program, or how to call the functions that interface with the operating system, or how to run a debugger. Every student in the class will be using a different model of computer (their own) and will therefore have to figure out these issues on their own. Part II of this course is given in operating system dependent sections for Unix and Windows.

Students with no computer can use NYU's Borland C (or C++) 4.51 under Microsoft Windows 3.1, for which the instructor will provide instructions.