strcat
The strcat function copies the content of a source string at the end of a destination string. It doesn't check if the destination string has enough space to append the copy, so it should be used with care.
The strcat function requires two arguments. The first argument is a pointer to the destination string. The second argument is a pointer to the source string.
The following code shows an example of strcat in use:
#include#include int main() { char *src = "source string"; char dest[50] = "beginning of "; // destination string // (notice that it must have enough space strcat(dest, src); printf("the destination string is now '%s'\n", dest); return 0; }
Article created on 2008-08-19 22:13:30
Post a comment