Your contacts, organized and persistent. A console-based Address Book written in C with full CRUD operations, smart sorting, input validation, and automatic file storage — all from the terminal.
| Feature | Description |
|---|---|
| ➕ Create | Add contacts with name, phone number, and email |
| 🔍 Search | Find contacts instantly by name |
| ✏️ Edit | Update any detail of an existing contact |
| 🗑️ Delete | Remove contacts cleanly from the address book |
| 📋 List & Sort | View all contacts — sort by Name, Phone, or Email |
| 💾 Persistent Storage | Contacts auto-saved to contacts.txt across sessions |
| ✅ Input Validation | Duplicate phone/email detection, name format checks |
AddressBook/
├── 📄 main.c # Entry point — menu-driven interface
├── 📄 contact.c # Core CRUD operations (create, search, edit, delete, list)
├── 📄 contact.h # Structs and function declarations
├── 📄 file.c # File handling — save and load contacts
├── 📄 file.h # File function declarations
├── 📄 validation.c # Input validation (name, phone, email)
├── 📄 populate.c # Helper to pre-populate sample contacts
├── 📄 populate.h # Populate function declaration
└── 📁 contacts.txt # Persistent contact storage (auto-generated)
- GCC compiler
- Linux / Unix environment (or WSL on Windows)
# Clone the repository
git clone https://github.com/<your-username>/AddressBook.git
cd AddressBook
# Compile
gcc main.c contact.c file.c validation.c populate.c -o addressbook
# Run
./addressbookOnce launched, you'll see an interactive menu:
+----------------------------------+
| ADDRESS BOOK MENU |
+----------------------------------+
| 1. Create contact |
| 2. Search contact |
| 3. Edit contact |
| 4. Delete contact |
| 5. List all contacts |
| 6. Save contacts |
+----------------------------------+
Enter a name, phone number, and email. The app checks for:
- 🚫 Duplicate phone numbers
- 🚫 Duplicate email addresses
- 🚫 Invalid name formats (numbers, special characters)
When listing contacts, choose your preferred sort order:
| Option | Sort By |
|---|---|
| 1 | 🔤 Name (A → Z) |
| 2 | 📞 Phone Number |
| 3 | 📧 Email Address |
| 4 | 🕐 Normal (insertion order) |
All contacts are saved to contacts.txt automatically. On the next launch, your address book is restored exactly as you left it — no data loss between sessions.
| Field | Validation |
|---|---|
| 👤 Name | Alphabets and spaces only; no numbers or symbols |
| 📞 Phone | Numeric only; no duplicate entries allowed |
Must follow [email protected] format; no duplicates |
| Concept | Role in Project |
|---|---|
| 🧱 Structures | Contact struct to bundle name, phone, and email |
| 📁 File Handling | Read/write contacts to contacts.txt for persistence |
| 🔡 String Manipulation | Search, compare, format, and validate contact fields |
| 🧩 Modular Programming | Logic split across contact.c, file.c, validation.c |
| 📐 Dynamic Arrays | Manage a growing list of contacts at runtime |
| ✅ Input Validation | Prevent duplicates and enforce field format rules |
- Language: C
- Compiler: GCC
- Platform: Linux / Unix / WSL
Amar C M 🔧 Embedded Systems Engineer
This project is open-source and available under the MIT License.
💡 "Good code is organized code — and so are good contacts."