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 (8/28):
hello.c.
- Very simple example of I/O (9/11):
simple-io.c.
- Example of recursion (9/18):
recursive-sum.c.
- Example of loop (9/25):
sum1.c.
- Example of loop with array (9/25):
sum2.c
(safer version sum2a.c).
- Simple string example (10/16):
string-length.c
- Simple parameter-passing example (10/16):
params.c
- Program to echo command-line arguments (10/23):
echo-arguments.c.
- Program to copy characters from one file to another (10/23):
copy-file.c.
- Program to sum integers read from file (10/23):
sum-from-file.c.
- Program to generate random sequence of integers and sort them (not in
class):
sort-example.c.
- Program to test sort function, improved to get number of elements from
command-line argument and use qsort for sorting (11/13)
sort-improved.c.
- Makefile example (11/20):
Source code files and Makefile:
directory.
- Sorted linked list and test program (11/20):
Source code files and Makefile:
directory.
See Makefile for usage notes.
Other files