Write a ‘C’ program to copy one string into another string without using standard function
#include<stdio.h>
#include<conio.h>
void main()
{
int i=0;
char s1[10],s2[10];
clrscr();
printf("\n enter the string 1 \n");
gets(s1);
printf("\n enter the string 2\n");
gets(s2);
printf("\n string 1:-%s",s1);
printf("\n string 2:-%s",s2);
while(s1[i]!=NULL)
{
s2[i]=s1[i];
i++;
}
s2[i]='\0';
printf("\n After copy the string2= %s",s2);
getch();
}
#include<conio.h>
void main()
{
int i=0;
char s1[10],s2[10];
clrscr();
printf("\n enter the string 1 \n");
gets(s1);
printf("\n enter the string 2\n");
gets(s2);
printf("\n string 1:-%s",s1);
printf("\n string 2:-%s",s2);
while(s1[i]!=NULL)
{
s2[i]=s1[i];
i++;
}
s2[i]='\0';
printf("\n After copy the string2= %s",s2);
getch();
}
plz help to find the code without using string function that display reverse output
ReplyDeletelike....... i like pakistan
the output will pakistan like i
No....i like Pakistan the output is Full World Hate Pakistan... !!!
DeleteThis comment has been removed by the author.
ReplyDeletewow...superb code..... thanks
ReplyDelete
ReplyDeleteVery informative article.Thank you author for posting this kind of article .
http://www.wikitechy.com/view-article/string-copy-program-in-c-example-with-explanation
Both are really good,
Cheers,
Venkat