This repository contains 5 practice exercises for learning Structures and File Processing in C programming.
Option 1: Open in GitHub Codespaces (Recommended)
- Click the badge above to launch a fully configured development environment
- Compiler and all tools pre-installed
- Start coding immediately in your browser
Option 2: Clone Locally
git clone https://github.com/SwiftTuition/CP143-Structures-Exercises.git
cd CP143-Structures-Exercises-
Exercise_01: Product Inventory System (Easy)
- Structure basics and syntax
- Arrays of structures
- Searching and updating records
-
Exercise_02: Student Database (Medium)
- Sequential file I/O with structures
- Reading and writing text files
- Statistical calculations
-
Exercise_03: Bank Account Manager (Medium)
- Random-access file processing
- Binary file I/O
- Direct record access with fseek
-
Exercise_04: Contact Book System (Medium)
- CRUD operations (Create, Read, Update, Delete)
- Menu-driven interface
- File persistence
-
Exercise_05: Library Management System (Hard)
- Complete integrated system
- Multiple data structures
- Transaction processing
- Read the README in each exercise folder
- Open the .c file and locate the TODO comments
- Implement the required functions
- Compile and test:
cd Exercises/Exercise_01 gcc exercise_1.c -o exercise_1 ./exercise_1
Using GCC:
gcc exercise_X.c -o exercise_X
./exercise_XUsing Codespaces:
- Terminal is already set up with GCC
- Just compile and run as shown above
- Start with Exercise 1 and progress sequentially
- Test frequently as you write code
- Don't forget to close files with
fclose() - Always check if
fopen()returns NULL - Use
sizeof()for structure sizes in file I/O
Created by Swift Tuition for CP143 students at Stellenbosch University.