I am working on the classic phone book program in a C programming course, and am having a bit of difficulty with the structs, pointers, and dynamic memory allocation. The program should dynamically allocate and free memory as it moves along (as the user adds or deletes entries). For now I am focusing mainly on case 1, which is add an entry to the phone book. Later, I will move the add, delete, and print functionality to functions, but am keeping everything inside main for simplicity until then.

Can someone help me understand where I am going wrong in the add an entry part? When I run this code and examine the debug output, it seems there is an error writing to the memory address... so I assume I have an error in my pointers. Thanks for any help you can provide, I greatly appreciate it!

Code:
Description:
A program utilizing data structures to create, manipulate, and display phone book entries.  User can add, delete, and print the phone book entries.
*/

#include <stdio.h>     // Standard C input & output library
#include <stdlib.h>    // mallac, callac, and free functions


typedef struct PhoneBookEntry         // Declaration of phone book structure
{
     char FirstName[21];
     char LastName[21];
     int PhoneNum;
} person; 


int main() {             // Main driving function

    int select=0; // Integer variable for user input of phone book operation
    int contact_ctr=0; // Counter to track number of contacts
    int i=0; // Index for printing "for" loop
    
    person contacts[50];   // Declare an array of phone book entries
    person* pcontacts;  // Declare a pointer for array Entries
	//   pcontacts = &contacts[0];         // Initialize the pointer to the array's first position
    pcontacts = (person*) calloc(0, sizeof(person));    // Set pointer to allocated/initialized block of memory, size of person struct
    if (pcontacts == NULL)
       {printf("Out of memory!  Aborting...");
       return 1;}
    else  {}    // Do nothing!

    
    do {  // Print menu to screen, ask user for selection...
        printf("\nPhone Book Application:\n\n");
        printf("1) Add friend\n");
        printf("2) Delete friend\n");
        printf("3) Show phone book\n");
        printf("4) Exit\n");
        printf("What do you want to do? ");
        scanf("%d", &select);    // Store user input in variable "select"
        getchar();               // Clear the input buffer
   
        switch (select)
        {
               case 1:     // User wants to add an entry
                    contact_ctr++;
                    pcontacts = realloc(pcontacts, contact_ctr * sizeof(person));     // Reallocate memory for additional contact
                    printf("\nFirst name: ");
                    scanf("%s", contacts[contact_ctr-1].FirstName);
                    printf("Last name: ");
                    scanf("%s", contacts[contact_ctr-1].LastName);
                    printf("Phone number: ");
                    scanf("%d", contacts[contact_ctr-1].PhoneNum);
                    printf("Record added to the phone book\n\n");
                    break;
               case 2:    // User wants to delete an entry
               case 3:    // User wants to print the phone book
                    for(i=0; i<contact_ctr; i++)
                    {
                             printf("\n\nPhone Book Entries:\n\n");
                             printf("%s %s %d", contacts[contact_ctr-1].FirstName, contacts[contact_ctr-1].LastName, contacts[contact_ctr-1].PhoneNum);
                    } // end for loop
                    break;
               case 4:    // User wants to quit, break the switch and exit to loop
                    break;
               default:   // User entered a value other than 1,2,3, or 4.
                    printf("You entered an invalid selection.  Try again.\n\n\n"); 
                    break;
        }  // End switch statement
        }  // End do loop
        
   while (select!=4);
   
   printf("\nThis phone book will now close.  Goodbye!\n");
   // Pause program until user inputs any character
   getchar();
   // Return statement
   return 0;
}      // End main