1

I have an array, which contains some elements. I hope to add some elements to the end of this array. Do you think that can I do for this? I don't want vector. how to resize and add the new element follow the last element?

3
  • 1
    Why don't you want to use vector? That's what it's there for. Commented May 9, 2017 at 3:25
  • If you only want to add elements, you can also use deque, stack, queue, list Commented May 9, 2017 at 3:29
  • 2
    Questions like "I want to do <some really common thing> but I don't want to use <the standard library facility that exists to solve exactly that problem>" are generally not very useful to future visitors and usually don't get answered. If you need a wheel and there is a high-quality steel wheel available to you for free, don't chisel a half-assed wheel out of stone instead. You don't do yourself any favors. Commented May 9, 2017 at 3:35

2 Answers 2

1

You cannot do that.

Because of this, it does not make sense not to use vectors.

You have to use a dynamic array either from standard library like a vector or through making it your self by using memory management facilities like new operator.

You can learn more about vectors here.
You can learn more about new here

Sign up to request clarification or add additional context in comments.

Comments

1

you can use upper limit of your input for array size .Then you used an extra variable for control . But i suggested to you for use vactor for get better result.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.