Friday 12 August 2016

strcpy: Copy one string to another string using library function

String: strcpy(dest, source)

Copy one string to another string using library function


#include<stdio.h>
#include<string.h>
main()
{
                char s[60], d[60]="\0";
                printf("\nSource string:\t");
                gets(s);
                strcpy(d, s);
                printf("\nDestination string: %s", d);
}
Output:
Source string:  Hii How Are you
Destination string: Hii How Are you

No comments:

Post a Comment