✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Чи працюватиме код поданий далі? Якщо так, то який результат його виконання?
#include <iostream>
using namespace std;
struct str
{
char* txt;
int size;
};
void main()
{
str* obj = new str;
obj->txt = new char[20];
strcpy_s(obj->txt,20, "Text from obj");
str* obj2 = obj;
delete obj;
cout << obj2->txt;
delete[] obj->txt;
}