#include <cstdio>
#include <cstdlib>
struct S {
int val;
};
int main() {
S* s = (S*)malloc(4*sizeof(S));
s[0].val = 10;
s[1].val = 20;
s[2].val = 30;
s[3].val = 40;
for ( int i = 0; i < 4; ++i ) printf("s[%d]=%d\n", i, s[i].val );
printf("\n");
S* ns = &s[1];
ns->val = 100;
// same print
for ( int i = 0; i < 4; ++i ) printf("s[%d]=%d\n", i, s[i].val );
return 0;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNzdGRsaWI+CgpzdHJ1Y3QgUyB7CglpbnQgdmFsOwp9OwoKaW50IG1haW4oKSB7CglTKiBzID0gKFMqKW1hbGxvYyg0KnNpemVvZihTKSk7CglzWzBdLnZhbCA9IDEwOwoJc1sxXS52YWwgPSAyMDsKCXNbMl0udmFsID0gMzA7CglzWzNdLnZhbCA9IDQwOwoJZm9yICggaW50IGkgPSAwOyBpIDwgNDsgKytpICkgcHJpbnRmKCJzWyVkXT0lZFxuIiwgaSwgc1tpXS52YWwgKTsKCglwcmludGYoIlxuIik7CglTKiBucyA9ICZzWzFdOwoJbnMtPnZhbCA9IDEwMDsKCS8vIHNhbWUgcHJpbnQKCWZvciAoIGludCBpID0gMDsgaSA8IDQ7ICsraSApIHByaW50Zigic1slZF09JWRcbiIsIGksIHNbaV0udmFsICk7CgoJcmV0dXJuIDA7Cn0K