Hi Mikal, it doesn't look like the while loop will terminate.
Hmm... I think it will. At least it worked for the one 5-second test I did.
No seriously, the (outer) loop will always terminate because string
is being incremented at every iteration, and so eventually *string
, the while loop test condition, will attain a value of 0 when it gets to the end of the string.
Try dcb's test program:
It works great with both revisions of simpletx(). I like that tiny function! Thanks.
PS: You often see this kind of technique in old C strcpy code, like:
void strcpy(char *to, char *from)
while (*to++ = *from++); // !