Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "util.h"
- int RemoveDuplicates(int arr[], int size)
- {
- int n = 0;
- int i, j, count, k;
- count = size;
- // 1,2,1,4,4,3,5,2,1 || 1,2,0,4,0,3,5,0,0
- for (i = 0; i < size; i++)
- {
- for (j = i + 1; j < size; j++)
- {
- if (arr[i] == arr[j])
- {
- for (k = j; k < size; k++)
- {
- arr[k] = arr[k + 1];
- }
- size--;
- }
- }
- }
- while (n < count)
- {
- printf("%d ", arr[n]);
- n++;
- }
- printf("\n%d", size);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement