The Library Management System(LMS) is a simple data structures project implemented in the C programming Language using a Single Linked List (SLL).
๐ Library Management System (C Project using Singly Linked List)
๐งฉ Overview
The Library Management System is a Data Structures project implemented in C using a Singly Linked List (SLL). It manages a collection of books, allowing users to add, delete, borrow, return, search, and display books dynamically.
This project provides a clear demonstration of how linked lists can be used for dynamic data handling without using databases or arrays.
๐ฏ Features
โ Add Book โ Add a new book record with ID, title, and author. โ Display Books โ Show all books available in the library. โ Search Book โ Search a book by its ID. โ Delete Book โ Remove a book record permanently. โ Borrow Book โ Mark a book as borrowed (not available for others). โ Return Book โ Mark a borrowed book as returned. โ Exit โ Close the program safely.
โ Data Structure Used
This project uses a Singly Linked List (SLL) to store book details dynamically. Each node represents one book and contains:
struct Node { int id; char title[50]; char author[50]; int isBorrowed; // 0 = available, 1 = borrowed struct Node* next; };
id โ Unique book ID
title โ Title of the book
author โ Author name
isBorrowed โ Status of the book (available or borrowed)
next โ Pointer to the next node (book)
๐ง Core Operations
1๏ธโฃ Add Book
Prompts user to enter ID, title, and author.
Dynamically creates a new node and inserts it at the beginning of the list.
2๏ธโฃ Display Books
Traverses the linked list and displays all book details.
Shows whether each book is Available or Borrowed.
3๏ธโฃ Search Book
Searches a book by its unique ID.
Displays full book details if found.
4๏ธโฃ Delete Book
Deletes a book record from the linked list by ID.
Frees the memory using free() to avoid memory leaks.
5๏ธโฃ Borrow Book
Allows a user to borrow a book if it is available.
Changes the isBorrowed flag to 1 and marks it as โBorrowedโ.
6๏ธโฃ Return Book
Marks a borrowed book as returned.
Updates isBorrowed flag back to 0.
7๏ธโฃ Exit
Terminates the program safely and frees all dynamically allocated memory.
๐งฎ Algorithms Used
Operation Algorithm Summary
Insert Traverse till last node โ link new node at end Search Traverse and compare IDs until found Delete Locate node before target โ adjust pointer links Borrow/Return Traverse โ find by ID โ change status flag Display Traverse โ print all node data
๐ฅ Sample Menu
========= ๐ LIBRARY MANAGEMENT SYSTEM =========
- Add Book
- Display Books
- Search Book
- Borrow Book
- Return Book
- Delete Book
- Exit Enter your choice:
๐พ Example Output
Enter your choice: 1 Enter Book ID: 101 Enter Title: Data Structures in C Enter Author: Yashwanth Kanetkar โ Book added successfully!
Enter your choice: 4 Enter Book ID to borrow: 101 ๐ Book borrowed successfully!
Enter your choice: 2 ID: 101 Title: Data Structures in C Author: Yaswanth Kanetkar Status: Borrowed
๐งฐ Tools Used
Language: C
Compiler: GCC
IDE : Dev C++
Concepts Used: Structures, Pointers, Dynamic Memory Allocation, Singly Linked List
๐ Future Enhancements
Add File Handling to store records permanently.
Add Sorting (by title, author, or ID).
Add User Accounts and Fine Calculation for overdue returns.
Add Graphical Interface or building using Web Stack.
๐งพ Conclusion
This Library Management System demonstrates how Singly Linked Lists can be used to manage real-life data dynamically. It helps to understand:
Linked List traversal
Dynamic memory allocation
Node insertion, deletion, and modification
Real-world data handling using data structures
This project is ideal for beginners learning C programming and Data Structures.