#include<stdio.h>
#include<string.h>intmain(){chars1[20]="Hello, World!";chars2[20];printf("———————————————————————————————————————————");printf("\nProgram to copy the given string");printf("\n———————————————————————————————————————————");printf("\nInput string %s ",s1);strcpy(s2,s1);printf("\n\nThe copied string is %s ",s2);printf("\n———————————————————————————————————————————\n");return0;}
Output
codeaft@codeaft:~$ gcc codeaft.c codeaft@codeaft:~$ ./a.out
———————————————————————————————————————————
Program to copy the given string
———————————————————————————————————————————
Input string Hello, World!
The copied string is Hello, World!
———————————————————————————————————————————
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.