I have to eliminate duplicates from a array of characters using pointers and a function. I can t get it to work correctly:
void del_copy(char *p){
int n = strlen(p);
for (int i = 0; i < n; i++){ // Element that we compare
for (int j = i + 1; j < n;j++){ //We compare p + i element with the rest of the elements
if (*(p + i) == *(p + j)){ //If we find two similar, we eliminate that element by shifting
for (int k = i; k < n; k++)
*(p + k) = *(p + k + 1);
}
}
}
}