A Useful Online Book on C

S. Oualline, Practical C Programming, O'Reily & Associates, 1997
This online book is provided by library.books24x7.com and is restricted to be used by MIT only

Tips for 10.001

Click here for some helpful Tips

Examples for 10.001

Examples used in class are provided here to check your notes. To test run one of these codes, cut and paste the code into a text editor such as emacs and compile it in your own diretory. We will continue to add examples here as they are covered in class.

sumint.c
A C-code implementation of the SumInt Algorithm constructed in class
precedence.c
In-class examples illustrating precedence and associativity of operators
granularity.c
A program which illustrates one of the consequences of granularity for numerical analysis.
boolean.c
In-class examples of boolean operations.
elseif.c
A program which illustrates the else-if ladder (nested if statements).
bisect.c
C Code for the bisection algorithm discussed in class.
Examples of function usage:
Here's a more general version of bisect.c that uses a function to abstract and generalize the use of f(x), which is then composed in a separate file called bisectfunc1.c

polynomial.c and squareWithDriver.c can be compiled together using the unix syntax "gcc polynomial.c squareWithDriver.c to create a program that evaluates a polynomial as a collection of individual tasks. Note that the code for squareWithDriver.c includes a driver routine for testing purposes; this must be removed before compiling together with polynomial.c
vdwgasNR.c
A C program to solve for the Van der Waals equations of state for volume, given pressure and temperature by the user. This version is intended to illustrate the development of a driver routine which takes advantage of the library functions available in Numerical Recipes. It also illustrates scope, macros, and user of pointers and pointer-to-functions. The following numerical routines are invoked: rtsafe.c and zbrac.c. The utility nrerror() is also used, and may be found in the Numerical Recipes locker under nrutil.c.


Sample Midterm
This is a sample test to help you prepare for the midterm in 10.001
Sample Final Exam
This is a sample exam to help you prepare for the final in 10.001. It should serve to give you an idea of the kinds of questions one can expect on Matlab. Bear in mind, however, that it is from an earlier offering of the course, when some of the topics covered were a bit different from Fall 2002.

last modified: