In this program, you'll learn to how to copy given string into new string without using strcpy() function.
#include<stdio.h>
int main()
{
int i;
char copy[30], paste[30];
printf("Enter the string to copy: ");
gets(copy);
for(i=0; copy[i] != '\0'; i++)
{
paste[i] = copy[i];
}
paste[i] = '\0';
printf("Copied string is: ");
puts(paste);
return 0;
}
Enter the string to copy: Sample String
Copied string is: Sample String