Showing posts with label library functions. Show all posts
Showing posts with label library functions. Show all posts

Monday, 6 June 2016

C program to concatinate two strings without using library functions:


#include<stdio.h>
#include<string.h>
void  concat(char str1[],char str2[])
{
int i,j;
i=strlen(str1);
for(j=0;str2[j]!='\0';i++,j++)
{
str1[i]=str2[j];
    }
    str1[i]='\0';
 
}
main()
{
char str1[50],str2[30];
printf("enter the strings:");
gets(str1);
gets(str2);
concat(str1,str2);
printf("concat string is %s",str1);
}