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 Copy one string into other with using library function

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

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

strcpy(str2,str1);

printf("nCopied String : %s",str2);
getch();
}
Output :
Enter the String 1 : c4learn
Copied  String : c4learn

Explain me ?
  1. Copy “str1″ into “str2″.
  2. Result will be stored in “str2″
  3. strcpy functions is included in Header File : string.h
Functions Required :

No comments: