Home
Questions
Search
Forum
Contact
Guest Book
Polls!
Got a Question?
 
PREV
Write your own ....
NEXT
 
(31 / 301)
 
 



Write your own strcat() function





Here is a C function which implements the strcat() function...


/* Function to concatenate string t to end of s; return s */
char *myStrcat(char *s, const char *t)
{
    char *p = s;

    if (s == NULL || t == NULL)
        return s;   /* we need not have to do anything */

    while (*s)
        s++;

    while (*s++ = *t++)
        ;

    return p;
}



PREV
COMMENTS                                  INDEX                                  PRINT
NEXT



Last updated: November 3, 2005

www.cracktheinterview.com - Your destination for the most common IT interview questions, answers, frequently asked interview questions (FAQ), C Programs, C Datastructures for technical interviews conducted by the top IT companies around the world!