Since this is homework, I'll give you no code.
But, removing an item is pretty easy. The only complication is if you want it ordered afterwards. If you have an unordered array of items, then it's very easy to remove an item:
1) Take the value of the last element, and use it to overwrite the value of the element to be removed.
2) Reduce the items count by one.
If you have an ordered array of items, then it is a little more complex, because you need a loop:
1) Set index to index of item to remove,
2) Loop while index < count of items minus one
2.1) Copy array[index + 1] into array[index]
2.2) Increment index by one
2.3) Repeat from (2)
3) Reduce the items count by one.
"hmm Got it .. I will try ..
by the way OriginalGriff are you a student .. ?!
Because the solution you posted is very much similar as in my book but i can't understand from it ..."
It's pretty simple.
If we have a sorted array of five integers:
1 3 5 7 9
And we want to remove the second number (3) we will end up with a sorted array for four integers:
1 5 7 9
So, you start with the index pointing at the element you want to remove:
1 3 5 7 9
index---^
Then you copy the index + 1 element into it:
1 5 5 7 9
index---^
Then you move the index:
1 5 5 7 9
index-----^
And do it again:
1 5 7 7 9
index-----^
1 5 7 7 9
index-------^
You keep doing this until you run out of elements:
1 5 7 9 9
index---------^
So you reduce the elements count by one and you have the result:
1 5 7 9
Simple if you draw a picture, isn't it?