> mystery(char *s, char *t) {
> while(*s++ = *t++)
> ;
> }
On Fri, 14 Oct 2011, Josh Dersch wrote:
And I would tend to prefer a loop that involves some
sort of bounds
checking :).
In C, what happens when you do:
char A[1000];
char * t;
char * s;
strcpy(A,"anything");
t = &A[0];
s = &A[1];
strcpy(t,s); /*to delete a character*/
printf("%s",A);
t = &A[1];
s = &A[0];
strcpy(t,s); /*to insert a character*/
printf("%s",A);
<pedantic>
Why?
How SHOULD you do it?
In C, if you want ANY error checking, then YOU have to put it in, thus
making it an inappropriate language for beginners to write operating
systems in.
</pedantic>
--
Grumpy Ol' Fred cisin at
xenosoft.com