I have written it so it works, but I was wondering if anyone had advice on how to make it more efficient, or perhaps (I'm sure there is) a way to make it better.
Here is the code:
- Code: Select all
void squeeze(char s[], char d[])
{
int x, y;
for (x = 0; x < 100; ++x) /*100 is the size of my arrays*/
for (y = 0; y < 100; ++y) /*this sets every matching letter in the*/
if (s[x] == d[y]) /*first string to ' ' which i remove later*/
s[x] = ' ';
char f[100];
int m = 0;
for (x = 0; x < 100; ++x) /*this part of the code goes through*/
f[x] = s[x]; /*and removes all the ' ' chars*/
for (x = 0; x < 100; ++x)
if (f[x] != ' ')
s[m++] = f[x];
s[m] = '\0';
}
Thank you in advance for taking the time to read this.




