Evening, I have a question that I am looking for clarification on. My main problem is the book I am useing is not written very well, and I am looking for an "push" in the right dirrection.
Here is the question:
QUOTE
Write a function, removeAt, that takes 3 parameters: an array of intigers, the number of elements in the array, and an integer (say, index). The function should delete the array element indicated by index. If index is out of range or the array is empty, output the appropriate msg. (Note that after deleting the element, the number of elements is reduced by 1). Assume the array is unsorted.
So though my searching I haven't found a way to delete an element from an array. I am sure that this is simple, but I am new to cpp and at a loss.
I am not looking for code help (yet), but here is what I have so far.
CODE
int removeAt (const int array1 [], int elements, int index)
{
int find;
//bool found = false;
for (find =0; find < elements; find++)
if (array1[find] == index) //so I look for/find index...
//?????
return -1;
}
Please help
~A