This repository contains professionally refactored C programming assignments completed as part of a university course. The code has been enhanced with comprehensive documentation, improved naming conventions, and industry-standard practices while preserving all original functionality.
This repository showcases fundamental and advanced C programming concepts through four comprehensive assignments:
- Data Structures: Graphs, linked lists, priority queues
- Algorithms: Dijkstra's algorithm, TSP, Floyd-Warshall, insertion sort
- Number Theory: Prime numbers, Armstrong numbers, palindromes, strong numbers
- String Processing: Substring matching, similarity detection
All code has been professionally refactored with:
- ✅ Clear, descriptive variable and function names using
snake_case - ✅ Comprehensive documentation for all functions
- ✅ Header guards and modular design
- ✅ Optimized algorithms
- ✅ Clean, readable code structure
- Language: C (C99 standard)
- Compiler: GCC
- Build Tool: Make
- Libraries: Standard C library (
stdio.h,stdlib.h,string.h,math.h,limits.h)
Location: Assignment-1/
Description: Implements algorithms to identify special numbers (Armstrong, palindrome, prime, and strong numbers) within a given range.
Key Files:
NumClass.h- Function declarations with comprehensive documentationbasicClassification.c- Prime and strong number detectionadvancedClassificationLoop.c- Loop-based Armstrong & palindrome detectionadvancedClassificationRecursion.c- Recursive implementationsmain.c- Main driver program
How to Run:
cd Assignment-1
make
./mains < inputs/input1.txtFeatures:
- Armstrong number detection (narcissistic numbers)
- Palindrome number identification
- Prime number checking with optimized algorithm
- Strong number verification (factorial sum equals number)
Location: Assignment-2/
Description: Implements Floyd-Warshall algorithm to find shortest paths between all pairs of nodes in a weighted graph.
Key Files:
my_mat.h- Graph operations interfacemy_mat.c- Floyd-Warshall implementationmain.c- Interactive graph query system
How to Run:
cd Assignment-2
make
./progCommands:
A- Insert 10x10 adjacency matrixB i j- Check if nodesiandjare linkedC i j- Find minimum distance between nodesiandjD- Exit
Features:
- All-pairs shortest path computation
- Efficient Floyd-Warshall algorithm
- Interactive query system
Location: Assignment-3/
Description: Implements insertion sort and advanced text processing functions for substring and word similarity detection.
Key Files:
- Sorting Module:
- Text Processing Module:
How to Run:
cd Assignment-3
make
# Run sorting
./mainS < input_numbers.txt
# Run text finder
./mainT < input_text.txtFeatures:
- Insertion sort with element shifting
- Substring detection
- Word similarity check (one character difference)
Location: Assignment-4/
Description: Comprehensive graph library implementing Dijkstra's shortest path algorithm and Traveling Salesman Problem (TSP) solution.
Key Files:
graph.h/graph.c- Core graph data structure and operationsnodes.h/nodes.c- Node managementedges.h/edges.c- Edge managementqueue.h/queue.c- Priority queue for Dijkstra'salgo.h/algo.c- Dijkstra's & TSP algorithmsmain.c- Interactive graph interface
How to Run:
cd Assignment-4
make
./graphCommands:
A n v1 v2 ...- Build graph withnnodesB src dest- Add edge fromsrctodestD id- Delete node with IDidS src dest- Find shortest path fromsrctodestT n v1 v2 ...- Solve TSP for specified nodes
Features:
- Dynamic graph construction
- Dijkstra's shortest path algorithm with priority queue
- TSP solution using permutation-based approach
- Weighted directed graph support
- GCC compiler
- Make build tool
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/C-Course.git cd C-Course -
Navigate to an assignment:
cd Assignment-X -
Build the project:
make
-
Run the program:
./executable_name
-
Clean build artifacts (optional):
make clean
cd Assignment-1
make clean && make
echo "1 1000" | ./mainsThis codebase follows professional standards:
- Naming Conventions: Consistent
snake_casefor all C functions and variables - Documentation: Every function includes detailed doc comments explaining parameters, return values, and purpose
- Header Guards: All header files use proper include guards
- Memory Management: Proper allocation and deallocation of dynamic memory
- Modularity: Clear separation of concerns across multiple files
- Error Handling: Input validation and edge case handling
This project is academic work completed for university coursework. Please respect academic integrity policies when referencing this code.
Author: University Student
Course: C Programming
Year: 2024