Phone Book Management System In C With Source Code

The Phone Book Management System project is developed in the C programming language. It allows you to perform simple phonebook operations like on your mobile.

You can add, list, modify, search, and delete phonebook records. The Phone Book System in C is a console application without graphics.

File handling and data structure concepts have been extensively used for almost all functions in this mini-project.

This Phone Book Application In C also includes a downloadable Phone Book C Source Code for free, just find the downloadable source code below and click to start downloading.

To start creating a Phone Book System In C, make sure that you have code blocks or any platform of C language installed on your computer.

ABOUT PROJECTPROJECT DETAILS
Project Name :Phone Book Management System
Project Platform :C/C++
Programming Language Used:C Programming Language
Developer Name :itsourcecode.com
IDE Tool (Recommended):Dev-C++/Codeblocks
Project Type :Desktop Application
Database:Stores data in .DAT file
Phone Book Management System In C With Source Code Information

Steps on how to create a Phone Book Management System project In C With Source Code

Time needed: 5 minutes

Phone Book Management System In C With Source Code

  • Step 1: Create a new project.

    First open the code blocks IDE and click “create a new project“.
    create project

  • Step 2: Choose console application.

    Second click the “console application” and after that click “next“.
    phone book console application

  • Step 3: Choose C language.

    Third choose “C language” and click “next“.
    phone book console c

  • Step 4: Name Your Project.

    Fourth name the project you’ve created and click “next” after that click “finish“.
    phone book project title

  • Step 5: The actual code.

    You are free to copy the given source code below or download the downloadable source code given.

Complete Source Code

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<windows.h>
struct person
{
    char name[35];
    char address[50];
     char father_name[35];
     char mother_name[30];
    long int mble_no;
    char sex[8];
    char mail[100];
    char citision_no[20];

    };
void menu();
void got();
void start();
void back();
void addrecord();
void listrecord();
void modifyrecord();
void deleterecord();
void searchrecord();
int main()
{
    system("color 8f");
    start();
    return 0;
}
void back()
{
    start();
}
void start()
{
    menu();
}
void menu()
{
    system("cls");
printf("\t\t**********WELCOME TO PHONEBOOK*************");

printf("\n\n\t\t\t  MENU\t\t\n\n");
printf("\t1.Add New   \t2.List   \t3.Exit  \n\t4.Modify \t5.Search\t6.Delete");

switch(getch())
{
    case '1':

                addrecord();
    break;
   case '2': listrecord();
    break;
    case '3': exit(0);
    break;
    case '4': modifyrecord();
    break;
    case '5': searchrecord();
    break;
    case '6': deleterecord();
    break;
    default:
                system("cls");
                printf("\nEnter 1 to 6 only");
                printf("\n Enter any key");
                getch();

menu();
}
}
        void addrecord()
{
        system("cls");
        FILE *f;
        struct person p;
        f=fopen("project","ab+");
        printf("\n Enter name: ");
        got(p.name);
        printf("\nEnter the address: ");
        got(p.address);
        printf("\nEnter father name: ");
        got(p.father_name);
        printf("\nEnter mother name: ");
        got(p.mother_name);
        printf("\nEnter phone no.:");
        scanf("%ld",&p.mble_no);
        printf("Enter sex:");
        got(p.sex);
        printf("\nEnter e-mail:");
         got(p.mail);
        printf("\nEnter citizen no:");
        got(p.citision_no);
        fwrite(&p,sizeof(p),1,f);

      fflush(stdin);
        printf("\nrecord saved");

fclose(f);

    printf("\n\nEnter any key");

	 getch();
    system("cls");
    menu();
}
void listrecord()
{
    struct person p;
    FILE *f;
f=fopen("project","rb");
if(f==NULL)
{
printf("\nfile opening error in listing :");

exit(1);
}
while(fread(&p,sizeof(p),1,f)==1)
{
     printf("\n\n\n YOUR RECORD IS\n\n ");
        printf("\nName=%s\nAdress=%s\nFather name=%s\nMother name=%s\nMobile no=%ld\nSex=%s\nE-mail=%s\nCitizen no=%s",p.name,p.address,p.father_name,p.mother_name,p.mble_no,p.sex,p.mail,p.citision_no);

	 getch();
	 system("cls");
}
fclose(f);
 printf("\n Enter any key");
 getch();
    system("cls");
menu();
}
void searchrecord()
{
    struct person p;
FILE *f;
char name[100];

f=fopen("project","rb");
if(f==NULL)
{
    printf("\n error in opening\a\a\a\a");
    exit(1);

}
printf("\nEnter name of person to search\n");
got(name);
while(fread(&p,sizeof(p),1,f)==1)
{
    if(strcmp(p.name,name)==0)
    {
        printf("\n\tDetail Information About %s",name);
        printf("\nName:%s\naddress:%s\nFather name:%s\nMother name:%s\nMobile no:%ld\nsex:%s\nE-mail:%s\nCitision no:%s",p.name,p.address,p.father_name,p.mother_name,p.mble_no,p.sex,p.mail,p.citision_no);
    }
        else
        printf("file not found");

}
 fclose(f);
  printf("\n Enter any key");

	 getch();
    system("cls");
menu();
}
void deleterecord()
{
    struct person p;
    FILE *f,*ft;
	int flag;
	char name[100];
	f=fopen("project","rb");
	if(f==NULL)
		{

			printf("CONTACT'S DATA NOT ADDED YET.");

		}
	else
	{
		ft=fopen("temp","wb+");
		if(ft==NULL)

            printf("file opaning error");
		else

        {


		printf("Enter CONTACT'S NAME:");
		got(name);

		fflush(stdin);
		while(fread(&p,sizeof(p),1,f)==1)
		{
			if(strcmp(p.name,name)!=0)
				fwrite(&p,sizeof(p),1,ft);
			if(strcmp(p.name,name)==0)
                flag=1;
		}
	fclose(f);
	fclose(ft);
	if(flag!=1)
	{
		printf("NO CONACT'S RECORD TO DELETE.");
		remove("temp.txt");
	}
		else
		{
			remove("project");
			rename("temp.txt","project");
			printf("RECORD DELETED SUCCESSFULLY.");

		}
	}
}
 printf("\n Enter any key");

	 getch();
    system("cls");
menu();
}

void modifyrecord()
{
    int c;
    FILE *f;
    int flag=0;
    struct person p,s;
	char  name[50];
	f=fopen("project","rb+");
	if(f==NULL)
		{

			printf("CONTACT'S DATA NOT ADDED YET.");
			exit(1);


		}
	else
	{
	    system("cls");
		printf("\nEnter CONTACT'S NAME TO MODIFY:\n");
            got(name);
            while(fread(&p,sizeof(p),1,f)==1)
            {
                if(strcmp(name,p.name)==0)
                {



                    printf("\n Enter name:");
                    got(s.name);
                    printf("\nEnter the address:");
                    got(s.address);
                    printf("\nEnter father name:");
                    got(s.father_name);
                    printf("\nEnter mother name:");
                    got(s.mother_name);
                    printf("\nEnter phone no:");
                    scanf("%ld",&s.mble_no);
                    printf("\nEnter sex:");
                    got(s.sex);
                    printf("\nEnter e-mail:");
                    got(s.mail);
                    printf("\nEnter citizen no\n");
                    got(s.citision_no);
                    fseek(f,-sizeof(p),SEEK_CUR);
                    fwrite(&s,sizeof(p),1,f);
                    flag=1;
                    break;



                }
                fflush(stdin);


            }
            if(flag==1)
            {
                printf("\n your data id modified");

            }
            else
            {
                    printf(" \n data is not found");

            }
            fclose(f);
	}
	 printf("\n Enter any key");
	 getch();
    system("cls");
	menu();

}
void got(char *name)
{

   int i=0,j;
    char c,ch;
    do
    {
        c=getch();
                if(c!=8&&c!=13)
                {
                    *(name+i)=c;
                        putch(c);
                        i++;
                }
                if(c==8)
                {
                    if(i>0)
                    {
                        i--;
                    }
                   // printf("h");
                    system("cls");
                    for(j=0;j<i;j++)
                    {
                        ch=*(name+j);
                        putch(ch);

                    }

                }
    }while(c!=13);
      *(name+i)='\0';
}

Downloadable Source Code

Summary

The whole project is designed in ‘C’ language and different variables and strings have been used for the development of this project.

This mini project is easy to operate and understand by the users.

This simple project can enhance the knowledge of the beginners or the students to develop their skills in programming, also this project is easy to understand the module and its variables.

Related Articles

Inquiries

If you have any questions or suggestions about the Phone Book Management System In C, please feel free to leave a comment below.

Frequently Asked Questions

How does this C / C++ management system work?

Console application using struct arrays OR file-handling (fopen/fread/fwrite) for persistence. CRUD operations via numbered menu. Compile via gcc (C) or g++ (C++). Foundation BSIT 1st-2nd year mini-project.

What compiler do I need to run this C or C++ project?

For C: gcc (GNU Compiler Collection) or MinGW (Windows). For C++: g++. IDE options: Code::Blocks (lightweight, built-in compiler), Dev-C++ (classic Philippine BSIT favorite), Visual Studio Code with C/C++ extension, CLion (paid). To compile from terminal: gcc program.c -o program (for C) or g++ program.cpp -o program (for C++), then run with ./program (Linux/macOS) or program.exe (Windows).

How do I run this C / C++ project?

Open the .c or .cpp file in your IDE (Code::Blocks, Dev-C++, VS Code). Click Build (or press F9), then Run (or press F5). From terminal: navigate to project folder, run gcc/g++ command above, then ./program. If using file storage, make sure the data file (e.g. records.txt) is in the same folder as the executable.

Can I use this C / C++ project for a BSIT capstone or thesis?

C/C++ projects are usually accepted for 1st-2nd year mini-projects or as building blocks. For a full capstone you would typically pair them with a more interactive frontend (e.g. wrap C++ logic with a Java/Python/PHP frontend, or extend to GTK/Qt for a real GUI). Standalone console C++ capstones are accepted by some panels but rare in 2026.

Why am I getting ‘undeclared identifier’ or ‘cannot find header’ errors?

Three common C/C++ issues: (1) Missing #include directive, e.g. #include for printf, #include for strcpy. (2) conio.h is Windows-only (Borland/MinGW), not POSIX, use ncurses on Linux/macOS. (3) Linker error: function declared but not defined, ensure all source files are in the compile command (gcc main.c utils.c -o app) or use a Makefile.

Where can I find more C or C++ projects with source code?

Browse the C and C++ Projects hub for the full library. For Java desktop alternatives see Java Projects. For higher-level languages see Python Projects. For BSIT capstone idea lists see 150 Best Capstone Project Ideas.

Angel Jude Suarez

Full-Stack Developer at PIES IT Solution

Focuses on Python development, machine learning, and AI integration. Has built production AI systems including OpenAI Whisper integration for medical transcription and GPT-4o-powered diagnosis assistance. Strong background in pandas, scikit-learn, and TensorFlow.

Expertise: Python · PHP · Java · VB.NET · ASP.NET · Machine Learning · AI Integration · OpenCV · Django · CodeIgniter  · View all posts by Angel Jude Suarez →

1 thought on “Phone Book Management System In C With Source Code”

Leave a Comment