Demo

Name Description Files
Makefile Makefile to compile all programs Makefile
hello First program that prints "Hello, world!" hello.c
cat Reads from stdin and prints out the contents to stdout cat.c
string Short demo of using strings showcasing initialing and printing string.c
strings Writing functions to work with strings like finding the length or copying strings strings.c
strings_lib Using functions from <strings.h> library to work with strings strings_lib.c
errno Error messages for different errno values errno.c
float Showcasing how floating points have limited precision float.c
float_2 Adding two floats of very different magnitudes might result to no change to the big number float_2.c
float_3 Assigning a double to a float and back will lose precision float_3.c
argv Example of using command line arguments argv.c
stack_overflow Infinite recursion that results in a crash due to stack overflow. Compiling with -O2 will not result in stack overflow due to tail recursion optimization stack_overflow.c
sizeof Due to memory alignment, the size of a struct might be larger than the sum of the contained variables sizeof.c
bad_file Pass in a non-existent or a non-readable file to see the proper error message bad_file.c
bad_scan Trying to scan multiple numbers from a string that only contains one results in using uninitialized values for b and c. Showcasing using the return value of the scanf family bad_scan.c
bad_pointers The & operator requires an lvalue. Passing in an expression will result in a compilation error bad_pointers.c
malloc_test Example of using malloc malloc_test.c
ArrayList_test Using ArrayList ArrayList_test.c
ArrayList.h
ArrayList.c
mystery2 mystery2 function from the quiz study guide. Using left shift promotes uint8_t to an unsigned int mystery2.c
memory_leak Simple program that does not free allocated memory leading to a memory leak memory_leak.c
badcnt Two threads incrementing the same variable multiple times leading to blind writes badcnt.c
goodcnt The above program properly synchronized goodcnt.c
slowprimes Two workers testing for primality slowprimes.c slowprimes.py
primes Using Eratosthenes's sieve to count primes under n primes.c primes.py
bomb Showcasing using multiple threads for asynchronous I/O bomb.c
demos Zip file with all files for easy download demos.zip