Radical Developers welcomes all the visitors to be a member of the team. Come join us. Its all about open-source concept. All Programs are written and tested in MacOS X, Unix, Linux and may not match with the outputs of Turbo C++ in Windows

Sunday, January 9, 2011

Write a program to copy a string to another string using strcpy().


Source Code :

#include<stdio.h>
void main()
{
      char str1[20],str2[20];
      clrscr();
      printf("\nEnter a String : ");
      gets(str1);
      strcpy(str2,str1);
      printf("\nCopied String : %s",str2);
      getch();
}

Output :

Enter a String : Program

Copied String : Program

No comments:

Post a Comment