A CLI-based contact management system developed in C that demonstrates the practical use of singly linked lists, dynamic memory allocation, and file persistence.
- Dynamic Contact Management: Add, remove, and search for contacts by name using a linked list structure.
- Data Persistence: Automatically loads data from
agenda.txtat startup and saves all changes upon exiting. - Manual Reordering: Allows users to swap the positions of two contacts within the list while maintaining pointer integrity.
- Input Validation: Includes specific logic to validate phone number formats (
XX XXXXXXXXX) and email addresses (checking for the@symbol). - Safety Backups: Generates a
agenda_backup.txtbefore overwriting the main database to prevent data loss. - Memory Efficiency: Implements a cleanup function to free all allocated RAM before the program terminates.
- Language: C.
- Data Structure: Singly Linked List (
struct Contato). - Key Algorithms:
- Node insertion at the end of the list.
- Pointer manipulation for node swapping (reordering).
- Sequential search for contact retrieval.
-
Clone the repository:
git clone [https://github.com/your-username/your-repo-name.git](https://github.com/your-username/your-repo-name.git) cd your-repo-name -
Compile the project: You can use
gccto compile the source files:gcc phonebook.c funcoes.c -o phonebook
-
Run the application:
./phonebook
phonebook.c: Contains the main execution loop and menu logic.funcoes.c: Implementation of all core features (CRUD, sorting, file I/O).funcoes.h: Header file containing theContatostruct definition and function prototypes.
Developed by: Enzo Giacomin & Pedro Henrique Mognon De Bortoli.