Hi,
assuming that Element is a class,I prefer to create an array of objects size of which is unknown in this way: Element *elementArray = new Element[length];
Is there another way to create an array of objects size of which is unknown without using new key(without malloc too)?
I am asking this question, because I have to create this array in a function.As you know, a variable created in a function scope is automatically destroyed at the end of the scope.
On the other hand,when we use new,we have to use delete.I think that using new-delete in a function scope is meaningless,if there is a way not to use them.
So,what are your suggestions?