C program to Copy String (Manual)

#include <stdio.h>
int main() 

{
    char str1[50], str2[50];
    int i;

    printf("Enter the string : ");
    scanf("%s", str1);

    for(i = 0; str1[i] != '\0'; i++) 
    {
        str2[i] = str1[i];
    }
    str2[i] = '\0';

    printf("Copied: %s", str2);

    return 0;
}

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices