C program to concatenate two strings without using strcat() function

C program to concatenate two strings without using strncat() function

#include<stdio.h>
#include<conio.h>

void main()
{
char s1[30],s2[30],s3[60];
int i,j;
clrscr();

printf(“Enter first string:”);
gets(s1);
printf(“Enter second string:”);
gets(s2);

for(i=0;s1[i]!=’’;++i)
s3[i]=s1[i];

for(j=0;s2[j]!=’’;++j)
s3[i+j]=s2[j];

s3[i+j]=’’;

printf(“nThe concatenated string is: %s”,s3);
getch();
}

" data-link="https://twitter.com/intent/tweet?text=C+program+to+concatenate+two+strings+without+using+strcat%28%29+function&url=https%3A%2F%2Fwww.thecrazyprogrammer.com%2F2013%2F07%2Fc-program-to-concatenate-two-strings.html&via=">">Tweet
19 Shares

One thought on “C program to concatenate two strings without using strcat() function

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.