A complete library management system implemented in C using doubly linked lists as the core data structure.
- Book Management: Add, update, delete, and search books
- Member Management: Register, manage, and track library members
- Loan Management: Handle book borrowing, returning, and renewals
- Search System: Advanced search capabilities across all data types
- Reporting: Generate various reports and statistics
- Doubly Linked List: Custom implementation with full CRUD operations
- Modular Architecture: Clean separation of concerns with repository, service, and UI layers
- Memory Management: Efficient memory usage with proper cleanup
- Input Validation: Comprehensive data validation throughout
- Error Handling: Robust error handling and reporting
- Test Framework: Complete test suite with unit and integration tests
The system follows a layered architecture pattern:
┌─────────────────────────────────────┐
│ User Interface │
├─────────────────────────────────────┤
│ Business Logic │
│ (Services Layer) │
├─────────────────────────────────────┤
│ Data Access │
│ (Repository Layer) │
├─────────────────────────────────────┤
│ Core Data Structures │
│ (Doubly Linked List) │
└─────────────────────────────────────┘
- GCC compiler (version 7.0+)
- Make utility
- Standard C library
# Basic build
make
# Debug build with AddressSanitizer
make debug
# Release build (optimized)
make release
# Run tests
make test
# Memory leak check
make memcheck
# Clean build artifacts
make clean# Run the main application
./library_system
# Run tests
./test_runner-
Book Management
- Add new books to the library
- Search for books by title, author, ISBN, or category
- Update book information
- View available books
-
Member Management
- Register new library members
- Search and view member information
- Manage member status (active/suspended)
- Track member loan history
-
Loan Management
- Process book loans
- Handle book returns
- Manage loan renewals
- Track overdue books and fines
-
Reports and Statistics
- View library statistics
- Generate various reports
- Monitor system performance
The system includes sample data to demonstrate functionality:
- Sample books from programming and literature categories
- Test member accounts
- Example loan transactions
- ISBN (13-digit identifier)
- Title, Author, Publisher
- Publication year and category
- Copy management (total/available)
- Price and status
- Unique member ID
- Personal information (name, contact)
- Membership type (Regular/Premium)
- Loan tracking and status
- Unique loan ID
- Member and book references
- Date tracking (loan/due/return)
- Fine calculation and status
├── src/
│ ├── core/ # Core data structures
│ ├── models/ # Data models
│ ├── repositories/ # Data access layer
│ ├── services/ # Business logic
│ ├── ui/ # User interface
│ └── utils/ # Utilities
├── include/ # Header files
├── tests/ # Test suite
├── docs/ # Documentation
├── examples/ # Example code
└── Makefile # Build configuration
The project includes a comprehensive test suite:
# Run all tests
make test
# Individual test categories
- Doubly Linked List operations
- Data model validation
- Repository CRUD operations
- Service layer business logic- Use ASCII characters only for maximum compatibility
- Follow consistent naming conventions
- Implement proper error handling
- Include comprehensive comments
- Always free allocated memory
- Use proper null checks
- Avoid memory leaks (verified with Valgrind)
- Write tests for all new functionality
- Maintain high test coverage
- Test both success and failure cases
- Insert/Delete: O(1) for known positions, O(n) for search
- Search: O(n) for linear search
- Sort: O(n log n) using merge sort
- Memory usage scales linearly with data size
- Efficient memory pooling for frequent allocations
The modular design allows for easy extension:
- Add new data models
- Implement additional search algorithms
- Extend reporting capabilities
- Add file persistence
- Integrate with databases
- Follow the established code style
- Write comprehensive tests
- Update documentation
- Ensure memory safety
This project is provided as an educational example. Feel free to use and modify for learning purposes.
This system is specifically designed to use only ASCII characters for maximum compatibility across different systems and environments. All text output, data validation, and user interfaces are ASCII-compliant.
Built with C programming language and doubly linked lists for educational and practical library management.