#include<stdio.h> main() { int i,j=0,k,l,m,n,o; char *p,*q,str1[50],str2[50]; printf("Enter string 1\n"); gets(str1); printf("Enter string 2\n"); gets(str2); p=str1; q=str2; k=strlen(str1); l=strlen(str2); m=k+l; n=k; for(i=0;i<=l;i++) { *(p+n)=*(q+i); n++; } printf("Concatination of 2 strings is "); for(i=0;i<=k+l-1;i++) { printf("%c",*p); p++; } }
Continue reading “Program to concatinate two strings using pointers”