About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Tuesday, September 3, 2013

C Program to Concat Two Strings with using Library Function

#include
#include
#include
void main()
{
char str1[100];
char str2[100];
char str3[100];
int len;

printf("\nEnter the String 1 : ");
gets(str1);

printf("\nEnter the String 2 : ");
gets(str2);

strcpy(str3,str1);
strcat(str3,str2);

printf("\nConcated String : %s",str3);
getch();
}

Explain me ?
  1. Copy “str1″ into “str3″.
  2. Then Concat “str2″ to “str3″ , after concating result will be stored in “str3″
  3. strcat,strcpy functions are included in Header File : string.h
Functions Required :

No comments: