Pages

Sunday 20 May 2012

program to copy of String


89./*Write a program to copy of String*/
#include<stdio.h>
#include<conio.h>
main()
{
            char str1[100],str2[100];
            int i;
            clrscr();
            printf("Enter the string:");
            gets(str1);
            for(i=0;str1[i]!='\0';i++)
            {
             str2[i]=str1[i];
            }
            str2[i]='\0';
            printf("\n The Original string is:%s",str1);
            printf("\n The Copied string is: %s",str2);
            getch();
}

OUTPUT
            Enter the string: MAHESH
            The Original string is : MAHESH
            The Copied string is: MAHESH

No comments:

Post a Comment