Pages

Subscribe:

Concatenation Two Strings In C

This program concatenation  two strings using c Program .Without using library function Strcat() provided by the library file <String.h>.Here use two character pointer , they are concatenated .



Program code :

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

void stcat(char *str1, char *str2);
void main()
{
        char *str1, *str2;
        clrscr();
        printf("\n\n\t ENTER THE FIRST STRING...: ");
        gets(str1);
        printf("\n\n\t ENTER THE SECOND STRING...: ");
        gets(str2);
        stcat(str1,str2);
        printf("\n\t THE CONCATENATED STRING IS...: ");
        puts(str1);
        getch();
}
void stcat (char *str1, char *str2)
{
        int i = 0,len = 0;
        while(*(str1+len)!='\0')
        len++;
       while(*(str2+i)!='\0')
       {
               *(str1+len) = *(str2+i);
               i++;
               len++;
       }
       *(str1+len) = '\0';
}








If you have any Further Information and Quires about this Article don't hesitate to comment in comment box below.
                                                           AND

 If you like this article , like our Facebook like page and click  +1 to support 123techguide
comments powered by Disqus
 

Listed In

Bloggers - Meet Millions of Bloggers http://Link-exchange.comxa.com
Blog Search: The Source for Blogs Internet Blogs

Disclaimer

The contents in this blog are taken from various sources available over the internet, therefore we do not gurantee of it's accuracy, if you find any of the content in the blog is infringing it's copyright, please do email us on '123techguide@gmail.com' and we will make sure to remove the same from the blog at the earliest.