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