RSS

Write a program to implement strcat()

Fri, Mar 5, 2010

Algorithm

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;
}

Sharing ~ Helping Other:
  • Print
  • email
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • BlinkList
  • DZone
  • Slashdot
  • YahooMyWeb
  • StumbleUpon
  • Live
  • IndianPad
  • DotNetKicks
  • Technorati

Other Posts:

This post was written by:

eXclusiveMinds - who has written 500 posts on eXclusiveMinds.


Contact the author

Leave a Reply

You must be logged in to post a comment.