Lecture 32: Summary
In the beginning we reviewed basics of Computer Hardware. A modern computer consists of CPU, Main Memory, Hard Disk, and I/O devices. Registers are storage locations within a CPU. Earlier times programming consisted of writing code using the specific instruction set of a processor. This is called low-level/assembly-level programming.
High-level languages like C were developed to make the programming projects easier, portable and more manageable. C is an ancient programming language first developed for use primarily on Unix systems.
C lets programmers write relatively well-structured programs. C is widely used in system software development and serves as a foundation of many programming languages.
We reviewed various basic concepts in programming which is applicable in most imperative programming languages:
- Variables: named memory locations to hold a value.
- Expressions: Expressions consist of operators applied to variables to produce new values
- Selection Statements: if..else statement combinations allow us to select among one of many choices.
- Repeatition: Loop constructs allow us to repeatedly execute a set of statements. while loops, for loops are equivalent.
Standard Library: Standard libraries provides set of useful functions for the programmer to use in his/her programs. We covered functions from stdio.h, stdlib.h, and string.h
Functions: We discussed C functions extensively and used it to develop modular C programs. We emphasized writing C programs as a series of functions and practiced that approach in various programming assignments.
File Processing: We reviewed basic file processing functions in the standard library stdio.h: fopen (), fclose (), fgetc (), fputc (). We later saw how to build our own higher-level functions using the basic set to read/write a line of data from/to an underlying stream.
Data structures:
C provides a few basic data structures. We discussed arrays and structures. We also discussed a basic sorting algorithm: selection sort.
Pointers: To be a good C programmer requires a solid understanding of the basics of pointers. We reviewed basic pointer material extensively and discussed function pointers briefly.
Take Home Message: When given a programming problem, first analyze and think through it (use paper and pencil, work with simple examples, visualize it). Structure your program around a set of relatively simple functions.
Beyond C : This course was primarily meant for students with little or no background in programming. We kept the material reasonably compact to avoid overwhelming those new to programming. The course hopefully laid a good foundation upon which you can build new skills. A good followup course would be C++ (CS department course CGS3464).
I enjoyed teaching this course and hope you had fun too!