#include<iostream>
#include<cstdlib>
using namespace std;
struct obj {
string innerstring;
};
struct c_obj {
char* string;
size_t length;
};
int main(void) {
struct obj a_obj, b_obj;
a_obj.innerstring = "a_obj";
b_obj.innerstring = "b_obj";
cout << "a_obj " << a_obj.innerstring << endl;
cout << "b_obj " << b_obj.innerstring << endl;
a_obj = b_obj;
cout << "a_obj " << a_obj.innerstring << endl;
cout << "b_obj " << b_obj.innerstring << endl;
b_obj.innerstring = "123";
cout << "a_obj " << a_obj.innerstring << endl;
cout << "b_obj " << b_obj.innerstring << endl;
struct c_obj a_c_obj, b_c_obj;
a_c_obj.length = 5;
a_c_obj.string = (char*)malloc(sizeof(char) * a_c_obj.length);
a_c_obj.string[0] = '1';
a_c_obj.string[1] = '2';
a_c_obj.string[2] = '3';
a_c_obj.string[3] = '4';
a_c_obj.string[4] = '\0';
printf("%s\n", a_c_obj.string);
b_c_obj = a_c_obj;
printf("%s\n", b_c_obj.string);
b_c_obj.string[0] = 'c';
b_c_obj.string[1] = 'h';
b_c_obj.string[2] = 'a';
b_c_obj.string[3] = 'n';
b_c_obj.string[4] = '\0';
printf("%s\n", a_c_obj.string);
printf("%s\n", b_c_obj.string);
return 0;
}