Neviete niekto, prečo mi program stále spadne keď príde pri delete ?
To + 3 je tam kvôli čiarky, medzere a nulovému znaku
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char name[20];
char name2[20];
char *ps;
cout << "Zadajte vase meno: ";
cin >> name;
cout << "Zadajte vase priezvisko: ";
cin >> name2;
ps = new char [strlen(name) + strlen(name2) + 3];
strncpy(ps, name, 20);
strcat(ps, ", ");
strncat(ps, name2, 20);
cout << ps << endl;
delete [] ps;
system("PAUSE");
}