CSCI 1120 (Low-Level Computing):
Sample Programs
Disclaimer: Code linked from this page is intended as a
cleaned-up and commented version of examples from class.
Many programs could be further improved with
regard to functionality or design, but then they would
no longer be as close to what we did in class.
Programs
- "Hello, world" program (1/29):
hello.c.
- Very simple example of I/O (not in class):
simple-io-1.c (no error
checking),
simple-io-2.c (error
checking).
- Example of recursion (2/19):
recursive-sum.c.
- Example of loop (2/26):
sum1.c.
- Example of loop with array (not in class):
sum2.c
(safer version sum2a.c).
- Program to generate random sequence of integers and sort them (2/26):
sort-example.c.
- Simple string example (3/05):
string-length.c
- Simple parameter-passing example (not in class):
params.c
- Program to echo command-line arguments (3/19):
echo-arguments.c.
- Program to copy characters from one file to another (3/19?):
copy-file.c.
- Program to sum integers read from file (3/19):
sum-from-file.c.
- "Floating point is strange" examples (3/26):
strange-float-1.c,
strange-float-2.c.
- Program to test sort function, improved to get number of elements from
command-line argument and use qsort for sorting (4/02):
sort-improved.c.
- Makefile example (04/23):
Source code files and Makefile:
directory.
- Sorted linked list and test program (04/23):
Source code files and Makefile:
directory.
See Makefile for usage notes.
Other files