Strcpy Char Array in C

Write a program using strcpy char array in c with example. Using this program we can copy the value of the variable in the c program which is stored in the variable. strcpy() is a C/C++ standard library function for copying one string to another. It can be found in the string.h header file in C and the cstring header file in C++.

#include<stdio.h>
#include<string.h>
int main()
{
char s1[10], s2[10];
strcpy(s1, "noteshippo.com");
strcpy(s2, s1);
printf("%s\n", s2);
return(0);
}

 

Output:

noteshippo.com