A robust console-based Inventory Management System developed in C with file handling, data structures, and a menu-driven interface for managing products, stock levels, and sales records.
- Features
- Project Structure
- Prerequisites
- Installation
- Compilation
- Usage
- File Format
- Technology Stack
- Author
- License
- β Add New Product - Add products with ID, name, category, price, quantity, and reorder level
- β View All Products - Display all products in a tabular format
- β Search Product - Search products by ID
- β Update Quantity - Update product stock levels
- β Update Price - Modify product pricing
- β Delete Product - Remove products from inventory
- β Check Low Stock - Alert when stock falls below reorder level
- β View Inventory Status - Check total products and inventory value
- β Low Stock Alert - Real-time warnings for products below reorder level
- β Total Inventory Value - Calculate total worth of all products
- β Product Listing - View all products with details
- β Record Sale - Log product sales with automatic stock deduction
- β Sales Report - View detailed sales history with revenue calculation
- β Automatic Stock Update - Inventory updates automatically on sale
- β Sale Tracking - Each sale has unique ID and timestamp
- β File Persistence - Data saved to text files
- β Auto-Load Data - Load existing inventory on startup
- β Cross-Platform - Works on Windows, Linux, and macOS
- β Data Validation - Input validation for all operations
Inventory-Management-System-in-C/
βββ headers/
β βββ product.h # Product structure and operations
β βββ inventory.h # Inventory management functions
β βββ file_handler.h # File I/O operations
βββ src/
β βββ main.c # Main application with menu system
β βββ product.c # Product implementation
β βββ inventory.c # Inventory implementation
β βββ file_handler.c # File handling implementation
βββ data/
β βββ products.txt # Products storage
β βββ sales.txt # Sales records
βββ README.md # Project documentation
βββ LICENSE # MIT License
βββ .gitignore # Git ignore rules
βββ Makefile # Build configuration
- GCC Compiler (gcc)
- Make utility
- C99 Standard or later
- Linux/Unix/Windows with terminal access
For Linux/macOS:
# Install GCC and Make
sudo apt-get install build-essential # Ubuntu/Debian
brew install gcc make # macOSFor Windows:
# Navigate to project directory
cd Inventory-Management-System-in-C
# Compile the project
make
# Or compile and run directly
make run# Create object files
gcc -Wall -Wextra -std=c99 -Iheaders -c src/main.c -o src/main.o
gcc -Wall -Wextra -std=c99 -Iheaders -c src/product.c -o src/product.o
gcc -Wall -Wextra -std=c99 -Iheaders -c src/inventory.c -o src/inventory.o
gcc -Wall -Wextra -std=c99 -Iheaders -c src/file_handler.c -o src/file_handler.o
# Link and create executable
gcc -o inventory src/main.o src/product.o src/inventory.o src/file_handler.ogcc -Wall -Wextra -std=c99 -Iheaders -o inventory src/*.c./inventoryββββββββββββββββββββββββββββββββββββββββββββββ
β INVENTORY MANAGEMENT SYSTEM (C) β
β Version 1.0 β
ββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββ
β MAIN MENU β
β βββββββββββββββββββββββββββββββββββββββββββββ£
β 1. Product Management β
β 2. Inventory Management β
β 3. Sales Management β
β 4. Save & Exit β
ββββββββββββββββββββββββββββββββββββββββββββββ
-
Add a Product:
- Select: 1 (Product Management) β 1 (Add New Product)
- Enter Product ID: 101
- Enter Name: Laptop
- Enter Category: Electronics
- Enter Price: 50000
- Enter Quantity: 10
- Enter Reorder Level: 3
-
View All Products:
- Select: 1 β 2 (View All Products)
-
Record a Sale:
- Select: 3 (Sales Management) β 1 (Record New Sale)
- Enter Product ID: 101
- Enter Quantity: 2
-
View Sales Report:
- Select: 3 β 2 (View Sales Report)
-
Check Inventory Status:
- Select: 2 (Inventory Management) β 1 (View Inventory Status)
-
Save & Exit:
- Select: 4 (Save & Exit)
ProductID|ProductName|Category|Price|Quantity|ReorderLevel
101|Laptop|Electronics|50000|10|3
102|Mouse|Electronics|500|50|10
103|Keyboard|Electronics|2000|25|5
SaleID|ProductID|Quantity|TotalAmount|Date&Time
1000|101|2|100000|2026-07-11 15:30:45
1001|102|5|2500|2026-07-11 15:35:20
- Language: C (C99 Standard)
- Paradigm: Procedural Programming
- File Format: Text files (pipe-delimited)
- Build System: Make
- Compiler: GCC
- Platform: Cross-platform (Linux, macOS, Windows)
typedef struct {
int productID;
char name[50];
char category[30];
float price;
int quantity;
int reorderLevel;
} Product;typedef struct {
Product products[100];
int totalProducts;
} Inventory;typedef struct {
int saleID;
int productID;
int quantity;
float totalAmount;
char date[20];
} Sale;addProduct()- Add new productdisplayProduct()- Show single productdisplayAllProducts()- Show all productsfindProductByID()- Search by IDupdateProductQuantity()- Update stockupdateProductPrice()- Update pricedeleteProduct()- Remove productcheckLowStock()- Stock alerts
initializeInventory()- InitializedisplayInventoryStatus()- Show statusgetInventoryValue()- Calculate valuedisplayLowStockAlert()- Show alerts
recordSale()- Record saledisplaySalesReport()- Show report
saveProductsToFile()- Save productsloadProductsFromFile()- Load productssaveSaleToFile()- Save saleloadSalesFromFile()- Load sales
make # Compile the project
make run # Compile and run
make clean # Remove build files
make rebuild # Clean and rebuild
make help # Show all commandsSolution: Install GCC compiler for your OS
Solution: Make file executable
chmod +x inventorySolution: The program creates it automatically. If not, manually create:
mkdir -p dataSolution: Ensure you run from the project root directory
- Add Products β View β Search
- Update Quantity β Record Sale β Verify Stock
- View Sales Report β Check Revenue
- Low Stock Alert β Reorder Check
- Save Data β Restart β Load Data
- Proficiency in C programming
- Understanding of data structures (structs, arrays)
- File I/O operations in C
- Menu-driven application design
- Real-world business logic implementation
- Cross-platform development
- Build system usage (Makefile)
- Software architecture and modularity
- Database integration (SQLite)
- User authentication
- Advanced reporting (PDF/CSV export)
- Graphical UI (GTK+/Qt)
- Multi-user support
- Network capability
- Backup/Restore feature
- Data encryption
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch
- Submit a pull request
Author: Deepak Kumar
GitHub: @deepaksaranay
Email: deepakkumar.dar@gmail.com
LinkedIn: linkedin.com/in/deepak-kumar-083448115
This project is licensed under the MIT License - see LICENSE file for details.
- C programming best practices
- Data structure design patterns
- File handling techniques
- Cross-platform development
Made with β€οΈ by Deepak Kumar
Last Updated: July 2026