Post Page Advertisement [Top]

C-Programming

Write a program in c to concatenate two string using pointer??

Home / c-programming /Write a program in c to concentrate two string using pointer??
Write a program in c to concentrate two string using pointer??
  

/*illustrate code*/
Write a program in c to concatenate two string using pointer??
#include<stdio.h>
#include<conio.h>
main()
{char s1[10],s2[10],*p1,*p2;
clrscr();
printf("\n enter first string");
gets(s1);
printf("\n enter second string");
gets(s2);
p1=s1;
while(*p1!=0)
{p1++;
}
p2=s2;
while(*p2!=0)
{*p1=*p2;
p1++;
p2++;
}
*p1=0;
printf("\n concatenate=%s",s1);
getch();
}






No comments:

Post a Comment

Bottom Ad [Post Page]