I have a program that uses getline to populate an array of strings. When I run this program, it outputs the correct values from the getline(cin) and then the program crashes, issuing the error messege "Process returned -1073741819 (0xC0000005)" I understand that this code has to deal with accessing memory locations. I have tried using pointers, but everything that I have tried has caused the program to crash in the same manner. Can you please provide advice on what I can do to fix this issue?
I am using Code::Blocks for this program on windows 10
edit: I am putting the strings in an array to be tested for the number of similar words
int wordCount = 0;
cout << "Enter the number of words in your email: ";
cin >> wordCount; //size of array determined by wordCount, which is retrieved from the user
string testEmail[wordCount] = { }; // declaring and initializing the array
cout << "Enter the email you wish to test: ";
getline(cin >> std::ws, testEmail[wordCount]); // this will populate the array from user input
cout << "The email that will be tested is: ";
for(int i=0; i<wordCount; i++) // for loop used for testing
cout << testEmail[i] << " ";