C Program – Concatenate two given string

by Nideesh C on April 18, 2011 · 0 comments

in C Programming




#include<stdio.h>
#include<conio.h>
void stcat(char str1[50], char str2[50]);
void main()
{
char str1[50], str2[50];
clrscr();
printf(“nnt ENTER THE FIRST STRING…: “);
gets(str1);
printf(“nnt ENTER THE FIRST STRING…: “);
gets(str2);
stcat(str1,str2);
printf(“nt THE CONCATENATED STRING IS…: “);
puts(str1);
getch();
}
void stcat(char str1[50], char str2[50])
{
int i = 0,len = 0;
while(str1[len]!=’′)
len++;
while(str2[i]!=’′)
{
str1[len] = str2[i];
i++;
len++;
}
str1[len] = ‘′;
}

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C Program – Concatenate two given string using Pointer
  2. C program – Copy the contents of one string to another string using pointer
  3. C program – To copy the contents of one string to another string
  4. C program To reverse the given string
  5. C Program – To replace a word by another word in a given string

Leave a Comment

Previous post:

Next post: