0
8.5kviews
Implement string copy function STRCPY (str1, str2) that copies a string str1(source) to another string str2(destination) without using library function.

Subject : Structured Programming Approach

Title : Arrays, String, Structures and Union

Difficulty : Medium

1 Answer
0
1.2kviews

Program:

#include<stdio.h>

#include<conio.h>

void main()

{

    char s1[100],s2[100],i;

    clrscr();

    printf(“enter string s1: “);

    scanf(“%s”,s1);

    for(i=0;s1[i]!=’\0’;++i)

    {

        s2[i]=s1[i]; 

    }

    s2[i]=’\0’;

    printf(“string s2: %s”,s2);

    getch();

}

Output:

Enter string s1:program

String s2: program
Please log in to add an answer.