PROGRAM TO COPY ONE STRING INTO ANOTHER STRING

/*PROGRAM TO COPY ONE STRING INTO ANOTHER STRING*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0;
char a[10],b[10];
clrscr();
printf(“Enter any string: “);
gets(a);
printf(“Before copying string is: “);
puts(a);
while(a[i]!=’\0′)
{
b[i]=a[i];
i++;
}
b[i]=’\0′;
printf(“Copied string is: “);
puts(b);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *