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();
}

Comments

  1. plz help to find the code without using string function that display reverse output
    like....... i like pakistan
    the output will pakistan like i

    ReplyDelete
    Replies
    1. No....i like Pakistan the output is Full World Hate Pakistan... !!!

      Delete
  2. This comment has been removed by the author.

    ReplyDelete


  3. Very 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


    ReplyDelete

Post a Comment