Hey what's the trick for incrementing an array by one and decrementing it by one. I know you can't actually do this to array's but I remember there is a trick maybe a temp. Not sure how to work this out.Thanks
Oh sorry, that was vague. I mean incremeting as in insertion of an element into an array. Incrementing the SIZE I meant. As I said I know you can't actually do this will array's but there is a way to acheive this with a temp array or something I can't remember. I would like to know both incrementing and decrementing. By decrementing I mean removal of an element.
Hopefully that explains it ...:)
Yeah I would use vectors if I could. I have intro c++ and we didn't cover vectors. I am aware of them. You know it was weird we did not cover them they were in the chapter. I feel that vectors are a better method. Although I'm not aware of all the advantages and disadvantages of array's vs vectors.
Anyways so does anyone know how to handle this with the pain in the a*s method of using vectors?
It might help if you explain exactly what it is you're trying to do with the container. Knowing that will help us clarify which way is better or easier for the situation (assuming you don't have to use arrays for this project).
And I'm not sure if you meant that vectors are a pain in the a$$ by what you said in your last sentence, but I can assure you they're quite easy to work with once you understand the concept behind them (which I can explain a bit later once we've delved into what you're trying to do with your program).
Arrays are fixed-size containers, by definition. There are no tricks to them, they simply cannot grow or shrink, ever. All you can do about it is create a new array, of different size, copy over the elements from the old array, and then destroy the old array. Or use a more appropriate container as suggested.