I need help with arrays

Q1. What is a character array?

Q2. How do we add another element in an array? For example;
1
2
3
int num=0;
int array[15]={2,4,5,7}
cin>>num // lets suppose num = 6 

I want the program to place 6 at the correct position, which is {2,4,5,6,7}.
Similarly if I want to add 3 or 1 or 15 or 9, how can I do that? Also, if I want to delete a number from the array, how can that be done?

I was sick on the day when my teacher gave a lecture on this and now I have an assignment due Monday. Oh and in-case you're thinking that the above questions are my homework, well, they're not. My homework is a bit complex than this, I just need to understand the basics first.
I suggest you first of all go through these tutorial pages:
http://www.cplusplus.com/doc/tutorial/arrays/
http://www.cplusplus.com/doc/tutorial/ntcs/

You probably won't be able to absorb all of that in one go (and you won't need all of it right now), but at least you know the pages are there for you to refer back to when required.

As inserting or deleting an element, you usually have to manipulate the contents of more than one element to do that, shuffling the elements along from one location to the next.

Last edited on
Topic archived. No new replies allowed.