Tuesday, July 28, 2009

I need a code which mimicks the strcat() function in C and would be called from main?

basically the main function would accept 2 user input character strings and then use the custom function to output a concatenated string just as strcat() does, Thanks in advance

I need a code which mimicks the strcat() function in C and would be called from main?
Here's a version that performs the functions of strcat() using other standard C library functions (strchr() and strcpy() in particular).





char *custom_strcat(char *s1, char *s2) {


strcpy(strchr(s1, 0), s2);


return s1;


}





If you are required to not use any standard C library functions at all, you may wish to think about what strchr() and strcpy() do, and rework the function from there.

jasmine

No comments:

Post a Comment