Copy one string from another - C - A5P2
in
SPNM
- on
6:22 PM
-
No comments
/* Write a program to copy one string from another */
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str1[50],str2[50];
int len,a;
clrscr();
printf("Enter String ->");
gets(str1);
len=strlen(str1);
for(a=0;a<len;a++)
{
str2[a]=str1[a];
}
str2[len]=NULL;
printf("\nOriginal String is -> %s",str1);
printf("\nCopied String is -> %s",str2);
getch();
}
Post a Comment