// Readability, probably introduced a bug or two, did not test it :) void remove_dup(char target[], char other[]) { int out_index = 0; for(int i = 0; target[i] != '\0'; ++i) { if(!is_dup(target[i], other)) target[out_index++] = target[i]; } target[out_index] = '\0'; } bool is_dup(char targetChar, char other[]) { for(int j = 0; other[j] != '\0'; ++j) if(target[i] == other[j]) return true; return false; }