Â
In this, we are going to see a program in which a string is Copied to another in C Programming Language.
//Copying string using strcpy()
#include <stdio.h>
#include <string.h>
int main()
{
char str1[20], str2[20];
printf("Enter a string: ");
scanf("%s", &str1);
//using strcpy to copy the contents of str1 on str2
strcpy(str2, str1);
printf("The copied string is: %s", str2);
return 0;
}
//..........coded by ANANYA MAURYA
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP