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/27):
hello.c.
- Very simple example of I/O (similar to what we did in class 9/10):
simple-io.c.
- Examples of recursion for repetition (9/24):
recursive-sum.c.
reverse-list.c.
- Example of loop (10/8):
loop-sum.c.
- Program (not complete)
to generate random sequence of integers and sort them (10/15):
sort-example.c.
- Simple example of using pointer parameters to fake
pass-by-reference (10/22):
pass-by-reference.c .
- Simple string example (10/22):
string-example.c .
- Program to echo command-line arguments (10/29):
echo-arguments.c.
- Program to copy characters from one file to another (not in class
but close):
copy-file.c.
- Program to sum integers read from file (10/29):
sum-from-file.c.
- "Floating point is strange" examples (11/05):
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 (11/12):
sort-improved.c.
- Makefile example (for 11/19 lecture):
Source code files and Makefile:
directory.
- Sorted linked list and test program (for 11/19 lecture):
Source code files and Makefile:
directory.
Other files