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 (08/24):
hello.c.
- Very simple example of variables, I/O, etc. (08/31):
simple-io.c.
- Simple example of conditional execution (09/07):
conditional.c.
- Simple example of functions (09/07):
functions.c.
- Simple example of while loop (9/14):
whilesum.c.
- Simple example of for loop and array(9/14):
sillyfor.c.
- Starter sort program (9/14, with revisions):
sort-starter.c.
- Simple example of function using pointer parameters (9/21)
divide.c.
- Simple example of for loop and array, revised to show some
pointer-related things (9/21)
sillyfor2.c.
- Simple example of using strings (9/21)
simple-strings.c.
- Less trivial example of using strings -- palindrome function (9/28)
palindrome.c.
- Program to echo command-line arguments (9/28)
echoargs.c.
- I/O examples (10/05):
countchars.c,
countchars-fromfile.c,
whilesum-fromfile.c.
- Program to test sort function, revised to get number of elements from
command-line argument and use qsort for sorting (10/12):
sort-improved.c.
- Program illustrating how sizes of data types can vary (10/12):
sizes.c.
- Makefile example (10/19):
Source code files and Makefiles
here.
- Linked-list example (10/26, 11/02):
Source code files and Makefile
here.
- "Floating point is strange" examples (11/09):
strange-float-1.c,
strange-float-2.c.
- Multithreading examples (11/16):
- ncurses examples (11/30, very briefly):
Other files