#include <iostream>
#include <cstring>
using namespace std;
#define SIZE (1)
struct arry
{
int *n = NULL;
int size;
arry() { n = new int[SIZE]; size = SIZE; }
~arry() { delete [] n; }
void incSize() {
int *temp = new int[size + 1];
memcpy(temp, n, sizeof(int) * size);
delete [] n;
n = temp;
size++;
}
};
int main() {
arry dyn;
dyn.n[0] = 100;
cout << sizeof dyn.n << endl;
cout << dyn.size << endl;
dyn.incSize();
cout << sizeof dyn.n << endl;
cout << dyn.size << endl;
dyn.n[1] = 200;
cout << dyn.n[0] << endl;
cout << dyn.n[1] << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgU0laRSAoMSkKc3RydWN0IGFycnkKewoJaW50ICpuID0gTlVMTDsKCWludCBzaXplOwoJYXJyeSgpCXsgbiA9IG5ldyBpbnRbU0laRV07IHNpemUgPSBTSVpFOyB9Cgl+YXJyeSgpIHsgZGVsZXRlIFtdIG47IH0KCXZvaWQgaW5jU2l6ZSgpIHsKCQlpbnQgKnRlbXAgPSBuZXcgaW50W3NpemUgKyAxXTsKCQltZW1jcHkodGVtcCwgbiwgc2l6ZW9mKGludCkgKiBzaXplKTsKCQlkZWxldGUgW10gbjsKCQluID0gdGVtcDsKCQlzaXplKys7Cgl9Cn07CgppbnQgbWFpbigpIHsKCQoJYXJyeSBkeW47CgkKCWR5bi5uWzBdID0gMTAwOwoJCgljb3V0IDw8IHNpemVvZiBkeW4ubiA8PCBlbmRsOwoJY291dCA8PCBkeW4uc2l6ZSA8PCBlbmRsOwoJCglkeW4uaW5jU2l6ZSgpOwoJCgljb3V0IDw8IHNpemVvZiBkeW4ubiA8PCBlbmRsOwoJY291dCA8PCBkeW4uc2l6ZSA8PCBlbmRsOwoJCglkeW4ublsxXSA9IDIwMDsKCQoJY291dCA8PCBkeW4ublswXSA8PCBlbmRsOwoJY291dCA8PCBkeW4ublsxXSA8PCBlbmRsOwoJCglyZXR1cm4gMDsKfQ==