- dist.c: calculating the distance between two points
- scanf.c: some examples of using
scanf
for various types - scanf2.c: using the returned value from
scanf
to check valid input - sq.c: Print all perfect squares <= 100
- largest.c: Find the largest number in a file of integers. largest.dat: a sample data file
- newton.c: a quick implementation of Newton's method.
- newton2.c: Newton's method using functions
- func.c: An example of using a function
- func2.c: Using a function to calculate roots in a quadratic. The overhead slide
- recur.c An example of recursion
- arr1.c: Filling and array and printing it back out
- dates.c: Using a structure to hold dates and a function that uses them.
- sort.c: Reading a file, sorting it, then writing the results. sort-start.c: Where the example started.
- ptr1.c: Printing the value and address of a variable
- ptr2.c: Playing with pointers
- The SortedArray data type (from a previous semester):
after one lecture,
after two lectures,
the final version: main.c, sortedlist.h, sortedlist.c. Compile with these commands:
gcc -Wall -c sortedlist.c gcc -Wall -c main.c gcc -o main main.o sortedlist.o
- Review problem solutions.