Q:

I have this issue where I run my program and I get a pop up saying Debug Assertion Failed

I have tried for maybe more than a week and still stuck. I even searched around for solutions but still got nowhere. Can anyone help me? Also I am new to Stack Overflow. I posted what I thought would be reasonable to look at, and not the whole program.
My program is basically a Library management system. I can edit, add and delete books perfectly but not when it comes adding the customers from the user.
I have a struct Customer, I read from a file and transfer the data to an array of Customer objects. But in my main, when I call method addCustomer is when I see the Debug Assertion Failed! 
It says :
Debug Assertion Failed!
Program: C:\Windows\system 32\MSVCP120D.dll

File: c\program files (x86)\microsoft visual studio 12.0\vc\xstring

Line: 1168
Expression: invalid null pointer.

My code:
struct Customer{

string first = "",
    last = "",
    id = "",
    phonenumber = "",
    email = "",
    BookID = "",
    return_date = "";
};

Adding the information to the array
void FileToArray(int& index, Customer library[]){
ifstream readCustomers;
readCustomers.open("CustomerDatabase.txt");

int i = 0;

// transfer file to array for customers

while (readCustomers >> library[i].id >> library[i].first >> library[i].last >> library[i].email
    >> library[i].phonenumber >> library[i].BookID >> library[i].return_date)

{
    i++;
}

index = i;

readCustomers.close();
}

Adding a customer
void addCustomer(int& index, Customer library[]){
/*
Adds customer to the database
*/

//Declarations
string firstName, lastName, email;

string phonenumber, NumBorrowed = 0;

// Get required input
cout << "First Name:" << endl;
cin.ignore(100, '\n');
getline(cin, firstName);

cout << "Last Name:" << endl;
getline(cin, lastName);

cout << "Email:" << endl;
getline(cin, email);

cout << "Phone Number:" << endl;
getline(cin, phonenumber);

// add to array for books
//LibraryCustomers[index].id = id;
library[index].first = firstName;
library[index].last = lastName;
library[index].email = email;
library[index].phonenumber = phonenumber;
library[index].BookID = "0";
library[index].return_date = "0";

index++;
}

main 
int main(){

int CustomerAddCount = 0;   // Will keep track of the last index that has been added.
Customer LibraryCustomers[1024]; // Transfering the data from file to array 

FileToArray(CustomerAddCount,LibraryCustomers);
addCustomer(CustomerAddCount,LibraryCustomers);

return 0;
}

Thanks

A:

This is the problematic line:
string phonenumber, NumBorrowed = 0;

Look at the type of the variables: they're both std::string objects.
std::string has no constructor which would take an int. But it does have one taking a const char*. This means the 0 is interpreted as a null pointer constant, used to create a null const char*, and passed to the constructor of std::string. That constructor has a precondition that its argument points to a valid, nul-terminated string. That's not the case, so the program crashes (actually asserts).
Of course, stepping through your program in a debugger would have told you.

