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/23):
hello.c.
- Almost-as-simple-as-possible example of I/O example (2/06):
simple-i-o.c.
- Program to sum integers read from standard input (9/19):
sum.c.
- Program to generate random numbers and show distribution when
converted to range (9/19):
rands.c.
- Simple program to test sort function (2/20):
sort-example.c.
- Simple program to demonstrate recursive Fibonacci function (not in class):
fibonacci.c.
- Function to get time of day as a double (not in class):
timer.h.
- Simple string example (also showing use of pointers as function
parameters) (2/27, 3/06):
string-example.c
(array version),
string-example-p.c
(pointer version),
- Program to sum integers read from file (3/06)
sum-from-file.c.
- Program to copy characters from stdin to stdout (3/06)
copy.c.
- Program to copy characters from one file to another (3/06)
copy-file.c.
- Program to echo command-line arguments (3/06):
echo-arguments.c.
- Program to test sort function, improved to get number of elements from
command-line argument and use qsort for sorting (4/10?)
sort-improved.c.
- Makefile example (04/17):
Source code files and Makefile:
directory.
- Sorted linked list and test program (04/24):
Source code files and Makefile:
directory.
See Makefile for usage notes.
Other files