| ??? 01/17/05 14:04 Read: times |
#85094 - Commented! :-) Responding to: ???'s previous message |
/*
The following function copies a zero-terminated string pointed by *src into *dest
*/
void strcpy(char *dest, char *src)
{
while (1) // infinite loop begins
{
*dest = *src; // copy one character from *dest to *src
if (*dest == ' ') // if the copied character is zero
return; // abort the loop and return
++dest; // increment destination pointer
++src; // increment source pointer
}
}
Do you really like this? If somebody can't read such a simple code directly in C, he qould not be able to modify it. wek PS. To feed the flames: this is also a very example of the C's weakness compared to Pascal - there is no check for overflow of either of the pointers. |



