2 ms·
Coming late to the party, here is my version. Even though it uses some weird constructs, it compiles and runs with TurboC V2.01 from 1988: char *d,*s;
by rayval 16y ago
Coming late to the party, here is my version. Even though it uses some weird constructs, it compiles and runs with TurboC V2.01 from 1988:
char *d,*s;
for(d = s = z_terminated;
*s;
s += (char_to_remove== *s)?1:((*d++ = *s++),0))
{;}
*d = *s;
Note this is the "fun version". For production code, I would use more conventional constructs, rather than the comma-delimited embedded expression with side effects.