So I need help with deleting duplicates in my array. I have to delete one of the duplicates and print out the rest.
ex. 1, 2 , 3, 3, 5
print out: 1, 2, 3, 5
The size of the array has to be 20 and the integers needs to be in between 10-100. My code is very messy and I am very new at this. So any help is greatly appreciated. Here i the code:
for( size_t k = j; k <SIZE; ++k)
{
data[k] = data[k+1];//shift all array elements from thereon leftwards
}
FYI this is identical to what I said, only doing it by hand instead of using the risky (but faster) memory functions. Again, if you can determine that you have more than 2 of the same value, you can delete them in bulk instead of one by one, which works regardless of how you do the data movement.