HOW DOI I CALL THIS USING THE FUNCTION AFTER THIS   getchar();     printf("Enter name : ");     // Here we are using '^' to be able to use a space in the input - >       scanf("%[^\ns]",p->name_1920213);     printf("Enter last name : ");     scanf("%s",p->lastname_1920213);           printf("Enter mobile number : ");     scanf("%ld",&p->contactnum_1920213);           printf("Enter email : ");     scanf("%s",p->email_1920213);    void search_person() /* this function allows the user to search a specific contacts  using the input name, last name, conatact number or email*/ {     int choice_1920213;     printf("\nChoose one option search for the contact details: \n\n1.First Name \t\t2.Last Name \n3.Mobile Number \t4.Email address \n "); scanf("%d",&choice_1920213);           while(1)     {     switch(choice_1920213)      /*Switch statement tests the value of a variable and compares it with multiple cases.      Once the case match is found, a block of statements associated with that particular case is executed     as given in this program. */     {     case 1: // THIS CASE IS FOR SEACHING CONTACT DETAILS USING FIRST NAME     //  //INPUT LAST NAME WILL RESULT TO PRINTING ALL CONTACT DETAILS OF THE EPRSON     {     struct p;          char fname_1920213[30];     printf("\n\nEnter the first name of the person you want to search : ");     scanf ("%s", fname_1920213);     FILE *fp;     fp = fopen("phonebook_1920213", "rb");     if (fp == NULL)          {     printf("Error occured while opening the file!\n");

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

HOW DOI I CALL THIS USING THE FUNCTION AFTER THIS

 

getchar();
    printf("Enter name : ");
    // Here we are using '^' to be able to use a space in the input - >  
    scanf("%[^\ns]",p->name_1920213);

    printf("Enter last name : ");
    scanf("%s",p->lastname_1920213); 
    
    printf("Enter mobile number : ");
    scanf("%ld",&p->contactnum_1920213); 
    
    printf("Enter email : ");
    scanf("%s",p->email_1920213); 

 

void search_person()
/* this function allows the user to search a specific contacts 
using the input name, last name, conatact number or email*/
{
    int choice_1920213;
    printf("\nChoose one option search for the contact details: \n\n1.First Name \t\t2.Last Name \n3.Mobile Number \t4.Email address \n ");
scanf("%d",&choice_1920213);
     
    while(1)
    {
    switch(choice_1920213) 
    /*Switch statement tests the value of a variable and compares it with multiple cases. 
    Once the case match is found, a block of statements associated with that particular case is executed
    as given in this program. */
    {
    case 1: // THIS CASE IS FOR SEACHING CONTACT DETAILS USING FIRST NAME
    //  //INPUT LAST NAME WILL RESULT TO PRINTING ALL CONTACT DETAILS OF THE EPRSON
    {
    struct p;
    
    char fname_1920213[30];
    printf("\n\nEnter the first name of the person you want to search : ");
    scanf ("%s", fname_1920213);

    FILE *fp;
    fp = fopen("phonebook_1920213", "rb");
    if (fp == NULL)
    
    {
    printf("Error occured while opening the file!\n");
 return;
    }
    else
    {
    long int contactnum_1920213 = 0;
    phonebook_1920213 p;
    while (fread(&p, sizeof(p), 1, fp) == 1)
    {
    if(strcmp(p.name_1920213, fname_1920213)==0)
    {
    //PRINTING ALL THE CONTACT DETAILS OF THE SEARCHED PERSON                
    printf("FIRST NAME: ");
    printf("%s",p.name_1920213);
    printf("\nLAST NAME: ");
    printf("%s",p.lastname_1920213);
    printf("\nCONTACT NUMBER: ");
    printf("%ld",p.contactnum_1920213);
    printf("\nEMAIL ADDRESS: ");
    printf("%s",p.email_1920213);
    printf("\n");
      printf("\nKINDLY PRESS ANY KEY TO CONTINUE USING THE PROGRAM!\n");

    contactnum_1920213 = 1;
    return;
    
        }
        else continue;
        }
        if(contactnum_1920213 == 0) 
        {
            printf("\nNo Results! The Person you have entered is not in the Phonebook\n");
        }
        fflush(stdin);
        fclose(fp);
         printf("\nKINDLY PRESS ANY KEY TO CONTINUE USING THE PROGRAM!\n");
         return;
    }
    }  
         getchar();
            break; 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education