So this is my code:
#include "stdafx.h"
#include <iostream>
using namespace std;
#define MAX 5
#define STR_LENGTH 40
void main()
{
char *p_str[MAX];
for (int i = 0; i < MAX; i++)
{
*(p_str+i) = new char(STR_LENGTH);
cout << "Please enter a string: ";
cin >> *(p_str+i);
}
for (int i = 0; i < MAX; i++)
{
cout << *(p_str+i) << endl;
delete (p_str+i);
}
}
And that last line in there, I have that delete, but it breaks when it gets there, any ideas how to solve it please?