I have this regular struct
struct Person{
char *name;
int age;
}
and I should do some regular stuff like, input size, create dynamic array of persons , and take user input for this person. But the problem, as you can see is how do I input in name pointer; I tried using buffer and simply pointing name to that buffer, yeah that works until buffer goes out of scope and destroys it self(at least I think he does..). Then I made global buffer and it works fine,but only for 1 person object, obviusly. Only soultion is to make global 2D dynamicly alocated char array in wich I will store inputs, and than use name pointer to point to them. That seems weird. Is there,and I hope that is some better way to do this. Reason why I don't use string or char array is because this is homework so I must use name pointer. Help me,please.