Skip to content

AmarCM/AddressBook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📒 Address Book — C Console Application

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.


✨ Features

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

🗂️ Project Structure

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)

🚀 Getting Started

🛠️ Prerequisites

  • GCC compiler
  • Linux / Unix environment (or WSL on Windows)

🔧 Build & Run

# 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
./addressbook

📖 Usage

Once 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                 |
+----------------------------------+

➕ Creating a Contact

Enter a name, phone number, and email. The app checks for:

  • 🚫 Duplicate phone numbers
  • 🚫 Duplicate email addresses
  • 🚫 Invalid name formats (numbers, special characters)

📋 Listing & Sorting Contacts

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)

💾 Persistent Storage

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.


✅ Input Validation Rules

Field Validation
👤 Name Alphabets and spaces only; no numbers or symbols
📞 Phone Numeric only; no duplicate entries allowed
📧 Email Must follow [email protected] format; no duplicates

🧠 Concepts Used

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

🛠️ Technologies Used

  • Language: C
  • Compiler: GCC
  • Platform: Linux / Unix / WSL

👤 Author

Amar C M 🔧 Embedded Systems Engineer

LinkedIn 📧 [email protected]


📜 License

This project is open-source and available under the MIT License.


💡 "Good code is organized code — and so are good contacts."

About

Console-based Address Book application in C — add, search, edit, delete, sort, and save contacts with file-based persistent storage

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages