While compiling my code I came across a segmentation fault in my code and really don't understand them. I'm not looking for a answer to my code more something that would help me understand what a segmentation fault is, and why it happens. For reference though, here is the code I was working on (I know its not a good way of going about this, but I am still learning).
void PhoneBook::verifyAllContacts() {
    Contact* listOfNumbers;
    listOfNumbers = new Contact[numContacts];
    int tempHoldCount = 0;
    for(int i = 0; i < numContacts; i++) {
        if(listOfNumbers[i].verifyPhoneNumber() == true && listOfNumbers[i].getEmergencyContact()->verifyPhoneNumber() == true)
            tempHoldCount++;
    }
    Contact* validContactList;
    validContactList = new Contact[tempHoldCount];
    for(int z = 0; z < tempHoldCount; z++) {
        for(int s = 0; s < numContacts; s++) {
            if(listOfNumbers[s].verifyPhoneNumber() == true && listOfNumbers[s].getEmergencyContact()->verifyPhoneNumber() == true)
                validContactList[z] = listOfNumbers[s];
        }
    }
    delete listOfNumbers;
}
 
     
     
    