C Program to Copy String to New String

In this program, you'll learn to how to copy given string into new string without using strcpy() function.

Source Code

int main()
    int i;
    char copy[30], paste[30];

    printf("Enter the string to copy: ");

    for(i=0; copy[i] != '\0'; i++)
        paste[i] = copy[i];
    paste[i] = '\0';

    printf("Copied string is: ");
    return 0;
Enter the string to copy: Sample String
Copied string is: Sample String

"Coding Hub - Learn to code" app now available on Google Play Store