Search



Wednesday, 4 March 2015

Copy a String without using strcpy

#include <stdio.h>
#include<conio.h>
void  main()
{   int i;
char s1[100], s2[100];
    clrscr();
    printf("\n\n program to copy string without using strcpy");
printf("\n Enter string s1: ");
scanf("%s",s1);
for(i=0; s1[i]!='\0'; i++)
{ s2[i]=s1[i];
}
s2[i]='\0';
printf("\n String s2: %s",s2);
getch();
}

No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.