void RemoveElement(int x,int as,Trades &array) //x =element(trade) to be removed, as=array size
Array[x] = array[x+1] will work if the struct does not have any strings or dynamic arrays.
Thank you for the info WHRoeder
I need the if because if the element to be removed is the final element, it's just a matter of resizing the array to remove it. If I didn't do that, the loop would give an array out of range error for [x+1]
Unfortunately I have been simply unable to get my head around classes, so have to stick to basic mql4.
for(;as-1 < as-1; x++)
Yes, you are correct, I confuse myself sometimes.
I should have said that when x==as-1, it has to be dealt with individually as [x+1] doesn't exist
Ah, I get you now.
Sorry, sometimes my brain dies :)