1
10kviews
Write a user defined function to copy one string to another.
1 Answer
0
509views

Program:

#include<stdio.h>
int main() {
char s1[100], s2[100];
int i;
printf("\nEnter the string :");
gets(s1);
i = 0;
while (s1[i] != '\0') {
s2[i] = s1[i];
i++;
}

s2[i] = '\0';
printf("\nCopied String is %s ", s2);
return (0);
}

Output:

Enter the string: KT280

Copied String: KT280

User Defined …

Create a free account to keep reading this post.

and 2 others joined a min ago.

Please log in to add an answer.