Here is the same code, without syntactic obfuscation:
void condense_by_removing(char* s, char c)
{
char* d = s;
while (*d = *s++)
d += *d != c;
}
I would have sworn I found a bug. There is none. Brilliant.Now, I wonder if we could further optimize it. For instance by accessing memory several bytes at a time, in a fashion similar to strcmp().