I'd like to make a void function that merge two arrays and delete duplicates then return the size of the array.
below is to merge two arrays. n1+n2 are less than 1000 for sure so I set result[1000]
1 2 3 4 5 6 7 8 9 10 11 12 13
size_t k = 0;
size_t i = 0;
while (i < n1) {
result[k] = arr1[i];
k++;
i++;
}
while (i < n2) {
k = n1;
result[k] = arr2[i];
k++;
i++;
}
and I wrote a code that checks if two elements are duplicates as below
1 2 3 4 5 6
for (size_t i=0; i < n; i++) {
for (size_t k = 0; k < n; k++) {
if (i!=k && array[i] == array[k]) ///???????????
}
}
I'm stuck here because I don't know how to remove the element from the array :( Can anybody give me wisdom. and I'd so appreciate if you glance at the merging arrays code if it's right