C Reference String Operation: strcpy()
The function strcpy() copies the characters from one string to another string.
Note: the null termination is also copied.
Usage:
char * strcpy( char *target, const char *source);
The return value of the strcpy function is target.
strcpy() source code example:
#include<stdio.h>
#include<string.h>
main()
{
char line[100];
strcpy(line, "hello,world!");
printf ("%s\n", line);
}
Output of the example:
hello,world!
This entry was posted in C Reference string.h Functions.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Tweet This! or use
to share this post with others.