I have an array, but I want to add something at the end without overwriting any of the data that is already present it it. It has to be an Array not a vector as it is an Assignment.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the comments, it sounds like you don’t want to add to the end of an array, but rather to partially fill an array and keep track of how much data you’ve written. You just need a variable to keep track of that:
You need to make sure that you never go beyond the end of the array, otherwise you will corrupt other memory.