Страницы

Translate

четверг, 5 сентября 2013 г.

Exercise 5.3. Write a pointer version of the function strcat that we showed in Chapter 2

Exercise 5.3. Write a pointer version of the function strcat that we showed in Chapter 2: strcat(s,t) copies the string t to the end of s.


* strcat */
void strcat(char *s, char *t)
{
    while(*s++) //search '\0'
        ;
    s--;
    while((*s++ = *t++) != '\0') //copies the string t to the end of s
        ;
}

Комментариев нет:

Отправить комментарий