Sample Programs
The following sample programs demonstrate many of the topics that were covered in Intro to C (COP 3223) as well as many of the new topics covered in this course.
Please note: YES, you can use any of the code, from these programs, for your programming assignments during the semester.
- Strings
- Files
- Reading Grades
- Average Temperature
- Simple Encoding
- Arrays and Files
- Structures
- Dynamic Memory Allocation for 1-D Arrays
- lottery.c
- lottery.in
- Dynamic Memory Allocation for 2-D Arrays (Arrays of Strings)
- arrayallocation.c
- arrayallocation2.c
- arrayallocation3.c (Not recommended!!!)
- arrayallocation4.c (Not recommended!!!)
- Basic searching and sorting
- Linked Lists
- linkedlist1.c (Add to End)
- linkedlist2.c (Add to Front)
- linklist.c (Several Functions)
- circularlinklist.c (Insertion)
- doublelinklist.c (Insertion)
- Linked List of Linked Lists
- Recursion
- recursion.c (first two recursion lectures)
- towers.c (Towers of Hanoi)
- mysqrt.c (Square Root Computation)
- basconv.c (Base Conversion)
- permute.c (Generating Permutations)
- permute2.c (Permutations with trace data)
- iterperm.c (Iterative Permutation)
- minesweeper.c (Text Minesweeper)
- Golf Fine Example
- Determining Run-Time Experimentally
- Stacks and Queues
- stack.c (Array Implementation of a Stack)
- stackll.c (Linked List Implementation of a Stack)
- queue.c (Array Implementation of a Queue)
- queuell.c (Linked List Implementation of a Queue)
- Binary Trees
- Advanced Sorting and Selection
- Hash Tables
- Heaps and Heap Sort
- Backtracking
- Min-Max Trees
- tttcomp.c (Computer Tic-Tac-Toe Player)
- Miscellaneous