I have the following code
struct A
{
char* str;
char* str1;
};
A a;
main(){
std::vector<A> vect;
string b = "Data structures using c and c++"
a.str = new char[10*sizeof(char*)];
a.str1 = new char[15*sizeof(char*)];
strcpy(a.str,b.c_str());
vect.push_back(a);
delete a.str;
}
After deleting a.str the value of vect is also getting erased. My question is is there any means so that the value retained in vect even after delete a.str